diff options
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index bb16e2ae4d..62b35fa708 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -473,6 +473,8 @@ static void insert_enter(InsertState *s) o_lnum = curwin->w_cursor.lnum; } + pum_check_clear(); + foldUpdateAfterInsert(); // When CTRL-C was typed got_int will be set, with the result // that the autocommands won't be executed. When mapped got_int @@ -1447,6 +1449,7 @@ ins_redraw ( redrawWinline(curwin, curwin->w_cursor.lnum); } + pum_check_clear(); if (must_redraw) { update_screen(0); } else if (clear_cmdline || redraw_cmdline) { @@ -2490,20 +2493,6 @@ void set_completion(colnr_T startcol, list_T *list) static pumitem_T *compl_match_array = NULL; static int compl_match_arraysize; -/* - * Update the screen and when there is any scrolling remove the popup menu. - */ -static void ins_compl_upd_pum(void) -{ - int h; - - if (compl_match_array != NULL) { - h = curwin->w_cline_height; - update_screen(0); - if (h != curwin->w_cline_height) - ins_compl_del_pum(); - } -} /* * Remove any popup menu. @@ -2511,7 +2500,7 @@ static void ins_compl_upd_pum(void) static void ins_compl_del_pum(void) { if (compl_match_array != NULL) { - pum_undisplay(); + pum_undisplay(false); xfree(compl_match_array); compl_match_array = NULL; } @@ -4305,17 +4294,14 @@ ins_compl_next ( } if (!allow_get_expansion) { - /* may undisplay the popup menu first */ - ins_compl_upd_pum(); - - /* redraw to show the user what was inserted */ + // redraw to show the user what was inserted update_screen(0); - /* display the updated popup menu */ + // display the updated popup menu ins_compl_show_pum(); - /* Delete old text to be replaced, since we're still searching and - * don't want to match ourselves! */ + // Delete old text to be replaced, since we're still searching and + // don't want to match ourselves! ins_compl_delete(); } @@ -4862,8 +4848,6 @@ static int ins_complete(int c, bool enable_pum) save_w_leftcol = curwin->w_leftcol; n = ins_compl_next(true, ins_compl_key2count(c), insert_match, false); - /* may undisplay the popup menu */ - ins_compl_upd_pum(); if (n > 1) /* all matches have been found */ compl_matches = n; @@ -7144,11 +7128,17 @@ static void ins_reg(void) * message for it. Only call it explicitly. */ ++no_u_sync; if (regname == '=') { - /* Sync undo when evaluating the expression calls setline() or - * append(), so that it can be undone separately. */ + pos_T curpos = curwin->w_cursor; + + // Sync undo when evaluating the expression calls setline() or + // append(), so that it can be undone separately. u_sync_once = 2; regname = get_expr_register(); + + // Cursor may be moved back a column. + curwin->w_cursor = curpos; + check_cursor(); } if (regname == NUL || !valid_yank_reg(regname, false)) { vim_beep(BO_REG); @@ -7939,7 +7929,6 @@ static void ins_mouse(int c) static void ins_mousescroll(int dir) { win_T *const old_curwin = curwin; - bool did_scroll = false; pos_T tpos = curwin->w_cursor; if (mouse_row >= 0 && mouse_col >= 0) { @@ -7969,7 +7958,6 @@ static void ins_mousescroll(int dir) } else { mouse_scroll_horiz(dir); } - did_scroll = true; } curwin->w_redr_status = TRUE; @@ -7977,14 +7965,6 @@ static void ins_mousescroll(int dir) curwin = old_curwin; curbuf = curwin->w_buffer; - /* The popup menu may overlay the window, need to redraw it. - * TODO: Would be more efficient to only redraw the windows that are - * overlapped by the popup menu. */ - if (pum_visible() && did_scroll) { - redraw_all_later(NOT_VALID); - ins_compl_show_pum(); - } - if (!equalpos(curwin->w_cursor, tpos)) { start_arrow(&tpos); can_cindent = true; |