changeset 11613:7428a08c2f68 v8.0.0689

patch 8.0.0689: ~ character not escaped when extending search pattern commit https://github.com/vim/vim/commit/a693d0584b9a7ccce98813dda3a6badb209904c7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 29 22:23:06 2017 +0200 patch 8.0.0689: ~ character not escaped when extending search pattern Problem: The ~ character is not escaped when adding to the search pattern with CTRL-L. (Ramel Eshed) Solution: Escape the character. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Thu, 29 Jun 2017 22:30:03 +0200
parents 8254ce2f2653
children f62e103bb674
files src/ex_getln.c src/testdir/test_search.vim src/version.c
diffstat 3 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1492,7 +1492,7 @@ getcmdline(
 			    if (c != NUL)
 			    {
 				if (c == firstc || vim_strchr((char_u *)(
-					      p_magic ? "\\^$.*[" : "\\^$"), c)
+					      p_magic ? "\\~^$.*[" : "\\^$"), c)
 								       != NULL)
 				{
 				    /* put a backslash before special
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -302,3 +302,23 @@ func Test_searchc()
   exe "norm 0t\u93cf"
   bw!
 endfunc
+
+func Test_search_cmdline3()
+  if !exists('+incsearch')
+    return
+  endif
+  " need to disable char_avail,
+  " so that expansion of commandline works
+  call test_override("char_avail", 1)
+  new
+  call setline(1, ['  1', '  2 the~e', '  3 the theother'])
+  set incsearch
+  1
+  " first match
+  call feedkeys("/the\<c-l>\<cr>", 'tx')
+  call assert_equal('  2 the~e', getline('.'))
+  " clean up
+  set noincsearch
+  call test_override("char_avail", 0)
+  bw!
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    689,
+/**/
     688,
 /**/
     687,