0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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)
This commit is contained in:
Bram Moolenaar
2017-06-29 22:23:06 +02:00
parent 9c4fefffb6
commit a693d0584b
3 changed files with 23 additions and 1 deletions

View File

@@ -1492,7 +1492,7 @@ getcmdline(
if (c != NUL) if (c != NUL)
{ {
if (c == firstc || vim_strchr((char_u *)( if (c == firstc || vim_strchr((char_u *)(
p_magic ? "\\^$.*[" : "\\^$"), c) p_magic ? "\\~^$.*[" : "\\^$"), c)
!= NULL) != NULL)
{ {
/* put a backslash before special /* put a backslash before special

View File

@@ -302,3 +302,23 @@ func Test_searchc()
exe "norm 0t\u93cf" exe "norm 0t\u93cf"
bw! bw!
endfunc 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

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
689,
/**/ /**/
688, 688,
/**/ /**/