Skip to content

Commit 73fd498

Browse files
committed
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)
1 parent 6270660 commit 73fd498

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/edit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3875,7 +3875,7 @@ ins_compl_prep(int c)
38753875
if (prev_col > 0)
38763876
dec_cursor();
38773877
/* only format when something was inserted */
3878-
if (!arrow_used && !ins_need_undo)
3878+
if (!arrow_used && !ins_need_undo && c != Ctrl_E)
38793879
insertchar(NUL, 0, -1);
38803880
if (prev_col > 0
38813881
&& ml_get_curline()[curwin->w_cursor.col] != NUL)

src/testdir/test_popup.vim

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,22 @@ func Test_completefunc_with_scratch_buffer()
464464
set completeopt&
465465
endfunc
466466

467+
" <C-E> - select original typed text before the completion started without
468+
" auto-wrap text.
469+
func Test_completion_ctrl_e_without_autowrap()
470+
new
471+
let tw_save=&tw
472+
set tw=78
473+
let li = [
474+
\ '" zzz',
475+
\ '" zzzyyyyyyyyyyyyyyyyyyy']
476+
call setline(1, li)
477+
0
478+
call feedkeys("A\<C-X>\<C-N>\<C-E>\<Esc>", "tx")
479+
call assert_equal(li, getline(1, '$'))
480+
481+
let &tw=tw_save
482+
q!
483+
endfunc
484+
467485
" vim: shiftwidth=2 sts=2 expandtab

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+
127,
767769
/**/
768770
126,
769771
/**/

0 commit comments

Comments
 (0)