Permalink
Browse files

patch 8.0.0127

Problem:    Cancelling completion still inserts text when formatting is done
            for 'textwidth'. (lacygoill)
Solution:   Don't format when CTRL-E was typed. (Hirohito Higashi,
            closes #1312)
  • Loading branch information...
1 parent 6270660 commit 73fd4988866c3adc15b5d093efdf5e8cf70d093d @brammool brammool committed Dec 9, 2016
Showing with 21 additions and 1 deletion.
  1. +1 −1 src/edit.c
  2. +18 −0 src/testdir/test_popup.vim
  3. +2 −0 src/version.c
View
@@ -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)
@@ -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
View
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 127,
+/**/
126,
/**/
125,

0 comments on commit 73fd498

Please sign in to comment.