diff options
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1cf821f786..962ef9b245 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -381,7 +381,7 @@ static void insert_enter(InsertState *s) // Need to recompute the cursor position, it might move when the cursor is // on a TAB or special character. - curs_columns(true); + curs_columns(curwin, true); // Enable langmap or IME, indicated by 'iminsert'. // Note that IME may enabled/disabled without us noticing here, thus the @@ -594,7 +594,7 @@ static int insert_check(VimState *state) if (curwin->w_wcol < s->mincol - curbuf->b_p_ts && curwin->w_wrow == curwin->w_winrow - + curwin->w_height_inner - 1 - get_scrolloff_value() + + curwin->w_height_inner - 1 - get_scrolloff_value(curwin) && (curwin->w_cursor.lnum != curwin->w_topline || curwin->w_topfill > 0)) { if (curwin->w_topfill > 0) { @@ -608,7 +608,7 @@ static int insert_check(VimState *state) } // May need to adjust w_topline to show the cursor. - update_topline(); + update_topline(curwin); s->did_backspace = false; @@ -1561,7 +1561,7 @@ void edit_putchar(int c, bool highlight) int attr; if (curwin->w_grid.chars != NULL || default_grid.chars != NULL) { - update_topline(); // just in case w_topline isn't valid + update_topline(curwin); // just in case w_topline isn't valid validate_cursor(); if (highlight) { attr = HL_ATTR(HLF_8); @@ -1677,7 +1677,7 @@ void display_dollar(colnr_T col) // If on the last byte of a multi-byte move to the first byte. char_u *p = get_cursor_line_ptr(); curwin->w_cursor.col -= utf_head_off(p, p + col); - curs_columns(false); // Recompute w_wrow and w_wcol + curs_columns(curwin, false); // Recompute w_wrow and w_wcol if (curwin->w_wcol < curwin->w_grid.Columns) { edit_putchar('$', false); dollar_vcol = curwin->w_virtcol; @@ -3423,7 +3423,7 @@ static void ins_compl_addleader(int c) xfree(compl_leader); compl_leader = vim_strnsave(get_cursor_line_ptr() + compl_col, - (int)(curwin->w_cursor.col - compl_col)); + curwin->w_cursor.col - compl_col); ins_compl_new_leader(); } @@ -3716,7 +3716,7 @@ static bool ins_compl_prep(int c) retval = true; } - auto_format(FALSE, TRUE); + auto_format(false, true); // Trigger the CompleteDonePre event to give scripts a chance to // act upon the completion before clearing the info, and restore @@ -3810,10 +3810,10 @@ static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg) */ static buf_T *ins_compl_next_buf(buf_T *buf, int flag) { - static win_T *wp; + static win_T *wp = NULL; if (flag == 'w') { // just windows - if (buf == curbuf) { // first call for this flag/expansion + if (buf == curbuf || wp == NULL) { // first call for this flag/expansion wp = curwin; } assert(wp); @@ -5327,8 +5327,9 @@ static int ins_complete(int c, bool enable_pum) compl_curr_match->cp_number); edit_submode_extra = match_ref; edit_submode_highl = HLF_R; - if (dollar_vcol >= 0) - curs_columns(FALSE); + if (dollar_vcol >= 0) { + curs_columns(curwin, false); + } } } } @@ -6158,7 +6159,7 @@ internal_format ( curwin->w_p_lbr = has_lbr; if (!format_only && haveto_redraw) { - update_topline(); + update_topline(curwin); redraw_curbuf_later(VALID); } } @@ -6503,7 +6504,7 @@ stop_insert ( curwin->w_cursor = tpos; } - auto_format(TRUE, FALSE); + auto_format(true, false); if (ascii_iswhite(cc)) { if (gchar_cursor() != NUL) @@ -6807,7 +6808,7 @@ cursor_up ( coladvance(curwin->w_curswant); if (upd_topline) { - update_topline(); // make sure curwin->w_topline is valid + update_topline(curwin); // make sure curwin->w_topline is valid } return OK; @@ -6858,7 +6859,7 @@ cursor_down ( coladvance(curwin->w_curswant); if (upd_topline) { - update_topline(); // make sure curwin->w_topline is valid + update_topline(curwin); // make sure curwin->w_topline is valid } return OK; @@ -7802,7 +7803,7 @@ static bool ins_esc(long *count, int cmdchar, bool nomove) // Otherwise remove the mode message. if (reg_recording != 0 || restart_edit != NUL) { showmode(); - } else if (p_smd) { + } else if (p_smd && (got_int || !skip_showmode())) { MSG(""); } // Exit Insert mode |