summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-06-29 22:23:06 +0200
committerBram Moolenaar <Bram@vim.org>2017-06-29 22:23:06 +0200
commita693d0584b9a7ccce98813dda3a6badb209904c7 (patch)
tree35a41c5739c3ba540acef03966f9e15a95037dab /src
parent9c4fefffb65a2ed9b4a5b0f1bde0da8f349470b5 (diff)
patch 8.0.0689: ~ character not escaped when extending search patternv8.0.0689
Problem: The ~ character is not escaped when adding to the search pattern with CTRL-L. (Ramel Eshed) Solution: Escape the character. (Christian Brabandt)
Diffstat (limited to 'src')
-rw-r--r--src/ex_getln.c2
-rw-r--r--src/testdir/test_search.vim20
-rw-r--r--src/version.c2
3 files changed, 23 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index ba8fde65e9..11de136bf7 100644
--- 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
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 730e683911..18a4577b7f 100644
--- 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
diff --git a/src/version.c b/src/version.c
index 7bf3f4e9c6..64f035dbd9 100644
--- 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,