aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-12-15 14:24:17 +0100
committerGitHub <noreply@github.com>2018-12-15 14:24:17 +0100
commit5e8f2048b5e7a3b06a6529283791f7030521f8a2 (patch)
treea4feadbaeb62916d90093b0ef19fbc31425c8326 /src
parent2aba5569a1fa3154560a4a715b48f8ddd5c0aa25 (diff)
parent845973c9fed0da7a0d471f5b57ab361961a3de93 (diff)
downloadrneovim-5e8f2048b5e7a3b06a6529283791f7030521f8a2.tar.gz
rneovim-5e8f2048b5e7a3b06a6529283791f7030521f8a2.tar.bz2
rneovim-5e8f2048b5e7a3b06a6529283791f7030521f8a2.zip
Merge #9367 'vim-patch:8.1.{585,588}'
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/testdir/test_signs.vim27
-rw-r--r--src/nvim/testdir/test_undo.vim2
3 files changed, 36 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 0a9b6ecc57..36c4e333cf 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -5685,6 +5685,14 @@ void ex_sign(exarg_T *eap)
int len;
arg += 5;
+ for (s = arg; s + 1 < p; s++) {
+ if (*s == '\\') {
+ // Remove a backslash, so that it is possible
+ // to use a space.
+ STRMOVE(s, s + 1);
+ p--;
+ }
+ }
// Count cells and check for non-printable chars
cells = 0;
diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim
index d3c6d05f4f..3960177acd 100644
--- a/src/nvim/testdir/test_signs.vim
+++ b/src/nvim/testdir/test_signs.vim
@@ -104,6 +104,33 @@ func Test_sign()
exe 'sign jump 43 file=' . fn
call assert_equal('B', getline('.'))
+ " can't define a sign with a non-printable character as text
+ call assert_fails("sign define Sign4 text=\e linehl=Comment", 'E239:')
+ call assert_fails("sign define Sign4 text=a\e linehl=Comment", 'E239:')
+ call assert_fails("sign define Sign4 text=\ea linehl=Comment", 'E239:')
+
+ " Only 1 or 2 character text is allowed
+ call assert_fails("sign define Sign4 text=abc linehl=Comment", 'E239:')
+ call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:')
+ call assert_fails("sign define Sign4 text=\ ab linehl=Comment", 'E239:')
+
+ " define sign with whitespace
+ sign define Sign4 text=\ X linehl=Comment
+ sign undefine Sign4
+ sign define Sign4 linehl=Comment text=\ X
+ sign undefine Sign4
+
+ sign define Sign5 text=X\ linehl=Comment
+ sign undefine Sign5
+ sign define Sign5 linehl=Comment text=X\
+ sign undefine Sign5
+
+ " define sign with backslash
+ sign define Sign4 text=\\\\ linehl=Comment
+ sign undefine Sign4
+ sign define Sign4 text=\\ linehl=Comment
+ sign undefine Sign4
+
" After undefining the sign, we should no longer be able to place it.
sign undefine Sign1
sign undefine Sign2
diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim
index 83ede1dc37..9729ca9f57 100644
--- a/src/nvim/testdir/test_undo.vim
+++ b/src/nvim/testdir/test_undo.vim
@@ -373,7 +373,7 @@ funct Test_undofile()
let cwd = getcwd()
if has('win32')
" Replace windows drive such as C:... into C%...
- let cwd = substitute(cwd, '^\([A-Z]\):', '\1%', 'g')
+ let cwd = substitute(cwd, '^\([a-zA-Z]\):', '\1%', 'g')
endif
let pathsep = has('win32') ? '\' : '/'
let cwd = substitute(cwd . pathsep . 'Xundofoo', pathsep, '%', 'g')