]> granicus.if.org Git - vim/commitdiff
patch 8.0.0689: ~ character not escaped when extending search pattern v8.0.0689
authorBram Moolenaar <Bram@vim.org>
Thu, 29 Jun 2017 20:23:06 +0000 (22:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 29 Jun 2017 20:23:06 +0000 (22:23 +0200)
Problem:    The ~ character is not escaped when adding to the search pattern
            with CTRL-L. (Ramel Eshed)
Solution:   Escape the character. (Christian Brabandt)

src/ex_getln.c
src/testdir/test_search.vim
src/version.c

index ba8fde65e94973a336a7791aa3f64c9c62b87304..11de136bf78c5d0c57df9897e6c1e04537e0e6a5 100644 (file)
@@ -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
index 730e68391140668c93e88e31ad1496c1124a933c..18a4577b7f7fbcb15e6e089b2b201655b0fd41a0 100644 (file)
@@ -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
index 7bf3f4e9c68f2580d077f91a52bc8d5b984e303f..64f035dbd9bda42002cca14efaebc51d351d6037 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    689,
 /**/
     688,
 /**/