Skip to content

Commit a693d05

Browse files
committed
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)
1 parent 9c4feff commit a693d05

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/ex_getln.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,7 @@ getcmdline(
14921492
if (c != NUL)
14931493
{
14941494
if (c == firstc || vim_strchr((char_u *)(
1495-
p_magic ? "\\^$.*[" : "\\^$"), c)
1495+
p_magic ? "\\~^$.*[" : "\\^$"), c)
14961496
!= NULL)
14971497
{
14981498
/* put a backslash before special

src/testdir/test_search.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,23 @@ func Test_searchc()
302302
exe "norm 0t\u93cf"
303303
bw!
304304
endfunc
305+
306+
func Test_search_cmdline3()
307+
if !exists('+incsearch')
308+
return
309+
endif
310+
" need to disable char_avail,
311+
" so that expansion of commandline works
312+
call test_override("char_avail", 1)
313+
new
314+
call setline(1, [' 1', ' 2 the~e', ' 3 the theother'])
315+
set incsearch
316+
1
317+
" first match
318+
call feedkeys("/the\<c-l>\<cr>", 'tx')
319+
call assert_equal(' 2 the~e', getline('.'))
320+
" clean up
321+
set noincsearch
322+
call test_override("char_avail", 0)
323+
bw!
324+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
689,
767769
/**/
768770
688,
769771
/**/

0 commit comments

Comments
 (0)