Hi Bram and all,
2016-12-8(Thu) 7:08:32 UTC+9 Bram Moolenaar:
> > If I write the following in `/tmp/vimrc.vim`:
>
> > ```
>
> >
>
> > setlocal tw=78
>
> > setlocal cc=78
>
> >
>
> > " zzz
>
> > " zzzyyyyyyyyyyyyyyyyyyy
>
> >
>
> > ```
>
> >
>
> > Then I launch Vim from the shell like this:
>
> >
>
> > vim -Nu /tmp/vimrc.vim /tmp/vimrc.vim
>
> >
>
> > Finally, in insert mode I position the cursor after `zzz`, hit `<C-x><C-n>`
> > to open the completion menu, hit and `<C-e>` to exit, here's the result:
>
> >
>
> > ```
>
> > setlocal tw=78
>
> > setlocal cc=78
>
> >
>
> > "
>
> > zzzyyyyyyyyyyyyyyyyyyyzzz
>
> > " zzzyyyyyyyyyyyyyyyyyyy
>
> > ```
>
> >
>
> > I expected the buffer to not change since I exited the menu. Besides
>
> > `zzz` is inserted twice.
>
>
>
> Looks like a bug.
I update a patch.
Added a test.
I checked that it's okay with patch, and fail without patch👍
Check it please.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
--
--
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.
diff --git a/src/edit.c b/src/edit.c
index 0d9e9d4..51a12b3 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3875,7 +3875,7 @@ ins_compl_prep(int c)
if (prev_col > 0)
dec_cursor();
/* only format when something was inserted */
- if (!arrow_used && !ins_need_undo)
+ if (!arrow_used && !ins_need_undo && c != Ctrl_E)
insertchar(NUL, 0, -1);
if (prev_col > 0
&& ml_get_curline()[curwin->w_cursor.col] != NUL)
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index f1e2c98..96c8d7e 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -464,4 +464,22 @@ func Test_completefunc_with_scratch_buffer()
set completeopt&
endfunc
+" <C-E> - select original typed text before the completion started without
+" auto-wrap text.
+func Test_completion_ctrl_e_without_autowrap()
+ new
+ let tw_save=&tw
+ set tw=78
+ let li = [
+ \ '" zzz',
+ \ '" zzzyyyyyyyyyyyyyyyyyyy']
+ call setline(1, li)
+ 0
+ call feedkeys("A\<C-X>\<C-N>\<C-E>\<Esc>", "tx")
+ call assert_equal(li, getline(1, '$'))
+
+ let &tw=tw_save
+ q!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab