To: vim_dev@googlegroups.com Subject: Patch 8.1.0588 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0588 Problem: Cannot define a sign with space in the text. Solution: Allow for escaping characters. (Ben Jackson, closes #2967) Files: src/ex_cmds.c, src/testdir/test_signs.vim *** ../vim-8.1.0587/src/ex_cmds.c 2018-11-10 18:54:40.660592045 +0100 --- src/ex_cmds.c 2018-12-14 19:28:26.340081284 +0100 *************** *** 7779,7784 **** --- 7779,7792 ---- 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) *** ../vim-8.1.0587/src/testdir/test_signs.vim 2017-10-27 00:40:58.000000000 +0200 --- src/testdir/test_signs.vim 2018-12-14 19:32:28.519179069 +0100 *************** *** 104,109 **** --- 104,136 ---- 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 *** ../vim-8.1.0587/src/version.c 2018-12-14 19:19:58.939094931 +0100 --- src/version.c 2018-12-14 19:36:51.285961178 +0100 *************** *** 801,802 **** --- 801,804 ---- { /* Add new patch number below this line */ + /**/ + 588, /**/ -- A)bort, R)etry, D)o it right this time /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///