aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-01 23:46:04 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 15:27:55 +0100
commitca24ad0b95c7f6360b3c4b732911558361bff3fe (patch)
tree9ceab9129ed4fe244a66318664afc44a8120ad4f /src
parentc8356e1151cf6db8cad93f74973a7452e62d6be0 (diff)
downloadrneovim-ca24ad0b95c7f6360b3c4b732911558361bff3fe.tar.gz
rneovim-ca24ad0b95c7f6360b3c4b732911558361bff3fe.tar.bz2
rneovim-ca24ad0b95c7f6360b3c4b732911558361bff3fe.zip
vim-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) https://github.com/vim/vim/commit/a693d0584b9a7ccce98813dda3a6badb209904c7
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/testdir/test_search.vim21
2 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 40b4cc6d79..bbe1d22473 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1549,7 +1549,7 @@ static int command_line_handle_key(CommandLineState *s)
}
if (s->c != NUL) {
if (s->c == s->firstc
- || vim_strchr((char_u *)(p_magic ? "\\^$.*[" : "\\^$"), s->c)
+ || vim_strchr((char_u *)(p_magic ? "\\~^$.*[" : "\\^$"), s->c)
!= NULL) {
// put a backslash before special characters
stuffcharReadbuff(s->c);
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index 4095ecac5d..6276eb2a34 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -306,3 +306,24 @@ func Test_searchc()
exe "norm 0t\u93cf"
bw!
endfunc
+
+func Test_search_cmdline3()
+ throw 'skipped: Nvim does not support test_override()'
+ 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