summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-12-09 19:36:56 +0100
committerBram Moolenaar <Bram@vim.org>2016-12-09 19:36:56 +0100
commit73fd4988866c3adc15b5d093efdf5e8cf70d093d (patch)
treef4cd6a17b1c30d955074c3ff01aef81b27fd2a2a
parent6270660611a151c5d0f614a5f0248ccdc80ed971 (diff)
downloadvim-git-8.0.0127.tar.gz
patch 8.0.0127v8.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)
-rw-r--r--src/edit.c2
-rw-r--r--src/testdir/test_popup.vim18
-rw-r--r--src/version.c2
3 files changed, 21 insertions, 1 deletions
diff --git a/src/edit.c b/src/edit.c
index 0d9e9d4a4..51a12b330 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 f1e2c98c4..96c8d7e30 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
diff --git a/src/version.c b/src/version.c
index 3cd19f177..39538a0c8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 127,
+/**/
126,
/**/
125,