On Do, 29 Jun 2017, Ramel Eshed wrote:

> Hi,
> 
> Please have a look:
> 
> vim -u NONE -N
> :set incsearch
> ia~b<ESC> (insert the text "a~b")
> ?a^L<CR> (search for 'a' and hit CTRL-L and ENTER)
> 
> I'm getting E33 because '~' is not escaped.

Here we go.



Best,
Christian
-- 
Viele Menschen warten ihr Leben lang auf die Gelegenheit, auf ihre Art
gut zu sein.
                -- Friedrich Wilhelm Nietzsche

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
From a6060b9c855e1672617e316ee39168a123165f0d Mon Sep 17 00:00:00 2001
From: Christian Brabandt <[email protected]>
Date: Thu, 29 Jun 2017 19:34:31 +0200
Subject: [PATCH] escape '~' when using <c-l> and incsearch is set

---
 src/ex_getln.c              |  2 +-
 src/testdir/test_search.vim | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/ex_getln.c b/src/ex_getln.c
index ba8fde65e..11de136bf 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 730e68391..18a4577b7 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
-- 
2.11.0

Raspunde prin e-mail lui