vim-patch:8.0.0043

Problem:    When using Insert mode completion with 'completeopt' containing
            "noinsert" with CTRL-N the change is not saved for undo.  (Tommy
            Allen)
Solution:   Call stop_arrow() before inserting for any key.
This commit is contained in:
Tommy Allen
2016-10-17 22:33:14 -04:00
parent d733beb0be
commit f2af6177fb

View File

@@ -3950,16 +3950,20 @@ static int ins_compl_get_exp(pos_T *ini)
/* Delete the old text being completed. */ /* Delete the old text being completed. */
static void ins_compl_delete(void) static void ins_compl_delete(void)
{ {
int i; int col;
/* // In insert mode: Delete the typed part.
* In insert mode: Delete the typed part. // In replace mode: Put the old characters back, if any.
* In replace mode: Put the old characters back, if any. col = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0);
*/ if ((int)curwin->w_cursor.col > col) {
i = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0); if (stop_arrow() == FAIL) {
backspace_until_column(i); return;
// TODO: is this sufficient for redrawing? Redrawing everything causes }
// flicker, thus we can't do that. backspace_until_column(col);
}
// TODO(vim): is this sufficient for redrawing? Redrawing everything
// causes flicker, thus we can't do that.
changed_cline_bef_curs(); changed_cline_bef_curs();
// clear v:completed_item // clear v:completed_item
set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc()); set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
@@ -4321,8 +4325,11 @@ static int ins_complete(int c, bool enable_pum)
colnr_T curs_col; /* cursor column */ colnr_T curs_col; /* cursor column */
int n; int n;
int save_w_wrow; int save_w_wrow;
int insert_match;
compl_direction = ins_compl_key2dir(c); compl_direction = ins_compl_key2dir(c);
insert_match = ins_compl_use_match(c);
if (!compl_started) { if (!compl_started) {
/* First time we hit ^N or ^P (in a row, I mean) */ /* First time we hit ^N or ^P (in a row, I mean) */
@@ -4655,6 +4662,8 @@ static int ins_complete(int c, bool enable_pum)
showmode(); showmode();
edit_submode_extra = NULL; edit_submode_extra = NULL;
ui_flush(); ui_flush();
} else if (insert_match && stop_arrow() == FAIL) {
return FAIL;
} }
compl_shown_match = compl_curr_match; compl_shown_match = compl_curr_match;
@@ -4664,7 +4673,7 @@ static int ins_complete(int c, bool enable_pum)
* Find next match (and following matches). * Find next match (and following matches).
*/ */
save_w_wrow = curwin->w_wrow; save_w_wrow = curwin->w_wrow;
n = ins_compl_next(TRUE, ins_compl_key2count(c), ins_compl_use_match(c)); n = ins_compl_next(true, ins_compl_key2count(c), insert_match);
/* may undisplay the popup menu */ /* may undisplay the popup menu */
ins_compl_upd_pum(); ins_compl_upd_pum();