Skip to content

Commit

Permalink
patch 8.0.0689: ~ character not escaped when extending search pattern
Browse files Browse the repository at this point in the history
Problem:    The ~ character is not escaped when adding to the search pattern
            with CTRL-L. (Ramel Eshed)
Solution:   Escape the character. (Christian Brabandt)
  • Loading branch information
brammool committed Jun 29, 2017
1 parent 9c4feff commit a693d05
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ex_getln.c
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions src/testdir/test_search.vim
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -764,6 +764,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
689,
/**/
688,
/**/
Expand Down

0 comments on commit a693d05

Please sign in to comment.