summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-14 19:37:08 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-14 19:37:08 +0100
commit06b056e110005ce0dd97b8c6333405afd06c36fc (patch)
treeb2d0a1a78c762c56df673a712e9bb30cd593d441 /src
parent06d4c4c818fe4258bdc3d455b7680fabadd719e4 (diff)
patch 8.1.0588: cannot define a sign with space in the textv8.1.0588
Problem: Cannot define a sign with space in the text. Solution: Allow for escaping characters. (Ben Jackson, closes #2967)
Diffstat (limited to 'src')
-rw-r--r--src/ex_cmds.c8
-rw-r--r--src/testdir/test_signs.vim27
-rw-r--r--src/version.c2
3 files changed, 37 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index cb728d4052..cd243a5ef4 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -7779,6 +7779,14 @@ 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;
+ }
# ifdef FEAT_MBYTE
/* Count cells and check for non-printable chars */
if (has_mbyte)
diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim
index a967435346..96e0244fed 100644
--- a/src/testdir/test_signs.vim
+++ b/src/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/version.c b/src/version.c
index cc609967a2..3c9eb0d884 100644
--- a/src/version.c
+++ b/src/version.c
@@ -800,6 +800,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 588,
+/**/
587,
/**/
586,