diff options
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 2e2c6ca737..9c590efdbc 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -417,7 +417,7 @@ int update_screen(int type) need_wait_return = false; } - win_ui_flush_positions(); + win_ui_flush(); msg_ext_check_clear(); /* reset cmdline_row now (may have been changed temporarily) */ @@ -1629,6 +1629,7 @@ static void win_update(win_T *wp) * changes are relevant). */ wp->w_valid |= VALID_BOTLINE; + wp->w_viewport_invalid = true; if (wp == curwin && wp->w_botline != old_botline && !recursive) { recursive = TRUE; curwin->w_valid &= ~VALID_TOPLINE; @@ -1648,7 +1649,7 @@ static void win_update(win_T *wp) /* restore got_int, unless CTRL-C was hit while redrawing */ if (!got_int) got_int = save_got_int; -} +} // NOLINT(readability/fn_size) /// Returns width of the signcolumn that should be used for the whole window /// @@ -2219,7 +2220,6 @@ win_line ( int tocol = MAXCOL; // end of inverting int fromcol_prev = -2; // start of inverting after cursor bool noinvcur = false; // don't invert the cursor - pos_T *top, *bot; int lnum_in_visual_area = false; pos_T pos; long v; @@ -2419,6 +2419,8 @@ win_line ( // handle Visual active in this window if (VIsual_active && wp->w_buffer == curwin->w_buffer) { + pos_T *top, *bot; + if (ltoreq(curwin->w_cursor, VIsual)) { // Visual is after curwin->w_cursor top = &curwin->w_cursor; @@ -3159,8 +3161,8 @@ win_line ( shl->endcol += (*mb_ptr2len)(line + shl->endcol); } - /* Loop to check if the match starts at the - * current position */ + // Loop to check if the match starts at the + // current position continue; } } @@ -5731,12 +5733,11 @@ static void end_search_hl(void) * Init for calling prepare_search_hl(). */ static void init_search_hl(win_T *wp) + FUNC_ATTR_NONNULL_ALL { - matchitem_T *cur; - - /* Setup for match and 'hlsearch' highlighting. Disable any previous - * match */ - cur = wp->w_match_head; + // Setup for match and 'hlsearch' highlighting. Disable any previous + // match + matchitem_T *cur = wp->w_match_head; while (cur != NULL) { cur->hl.rm = cur->match; if (cur->hlg_id == 0) @@ -5746,7 +5747,7 @@ static void init_search_hl(win_T *wp) cur->hl.buf = wp->w_buffer; cur->hl.lnum = 0; cur->hl.first_lnum = 0; - /* Set the time limit to 'redrawtime'. */ + // Set the time limit to 'redrawtime'. cur->hl.tm = profile_setlimit(p_rdt); cur = cur->next; } @@ -5762,18 +5763,16 @@ static void init_search_hl(win_T *wp) * Advance to the match in window "wp" line "lnum" or past it. */ static void prepare_search_hl(win_T *wp, linenr_T lnum) + FUNC_ATTR_NONNULL_ALL { - matchitem_T *cur; /* points to the match list */ - match_T *shl; /* points to search_hl or a match */ - int shl_flag; /* flag to indicate whether search_hl - has been processed or not */ - int n; - - /* - * When using a multi-line pattern, start searching at the top - * of the window or just after a closed fold. - * Do this both for search_hl and the match list. - */ + matchitem_T *cur; // points to the match list + match_T *shl; // points to search_hl or a match + bool shl_flag; // flag to indicate whether search_hl + // has been processed or not + + // When using a multi-line pattern, start searching at the top + // of the window or just after a closed fold. + // Do this both for search_hl and the match list. cur = wp->w_match_head; shl_flag = false; while (cur != NULL || shl_flag == false) { @@ -5800,7 +5799,7 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum) } bool pos_inprogress = true; // mark that a position match search is // in progress - n = 0; + int n = 0; while (shl->first_lnum < lnum && (shl->rm.regprog != NULL || (cur != NULL && pos_inprogress))) { next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, @@ -5838,6 +5837,7 @@ next_search_hl ( colnr_T mincol, /* minimal column for a match */ matchitem_T *cur /* to retrieve match positions if any */ ) + FUNC_ATTR_NONNULL_ARG(2) { linenr_T l; colnr_T matchcol; @@ -5845,11 +5845,10 @@ next_search_hl ( int save_called_emsg = called_emsg; if (shl->lnum != 0) { - /* Check for three situations: - * 1. If the "lnum" is below a previous match, start a new search. - * 2. If the previous match includes "mincol", use it. - * 3. Continue after the previous match. - */ + // Check for three situations: + // 1. If the "lnum" is below a previous match, start a new search. + // 2. If the previous match includes "mincol", use it. + // 3. Continue after the previous match. l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; if (lnum > l) shl->lnum = 0; @@ -5863,22 +5862,21 @@ next_search_hl ( */ called_emsg = FALSE; for (;; ) { - /* Stop searching after passing the time limit. */ + // Stop searching after passing the time limit. if (profile_passed_limit(shl->tm)) { shl->lnum = 0; /* no match found in time */ break; } - /* Three situations: - * 1. No useful previous match: search from start of line. - * 2. Not Vi compatible or empty match: continue at next character. - * Break the loop if this is beyond the end of the line. - * 3. Vi compatible searching: continue at end of previous match. - */ - if (shl->lnum == 0) + // Three situations: + // 1. No useful previous match: search from start of line. + // 2. Not Vi compatible or empty match: continue at next character. + // Break the loop if this is beyond the end of the line. + // 3. Vi compatible searching: continue at end of previous match. + if (shl->lnum == 0) { matchcol = 0; - else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL - || (shl->rm.endpos[0].lnum == 0 - && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) { + } else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL + || (shl->rm.endpos[0].lnum == 0 + && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) { char_u *ml; matchcol = shl->rm.startpos[0].col; @@ -5895,8 +5893,8 @@ next_search_hl ( shl->lnum = lnum; if (shl->rm.regprog != NULL) { - /* Remember whether shl->rm is using a copy of the regprog in - * cur->match. */ + // Remember whether shl->rm is using a copy of the regprog in + // cur->match. bool regprog_is_copy = (shl != &search_hl && cur != NULL && shl == &cur->hl @@ -5925,7 +5923,7 @@ next_search_hl ( nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol); } if (nmatched == 0) { - shl->lnum = 0; /* no match found */ + shl->lnum = 0; // no match found break; } if (shl->rm.startpos[0].lnum > 0 @@ -5933,7 +5931,7 @@ next_search_hl ( || nmatched > 1 || shl->rm.endpos[0].col > mincol) { shl->lnum += shl->rm.startpos[0].lnum; - break; /* useful match found */ + break; // useful match found } // Restore called_emsg for assert_fails(). @@ -5950,6 +5948,7 @@ next_search_hl_pos( posmatch_T *posmatch, // match positions colnr_T mincol // minimal column for a match ) + FUNC_ATTR_NONNULL_ALL { int i; int found = -1; @@ -6104,9 +6103,10 @@ void check_for_delay(int check_msg_scroll) && emsg_silent == 0) { ui_flush(); os_delay(1000L, true); - emsg_on_display = FALSE; - if (check_msg_scroll) - msg_scroll = FALSE; + emsg_on_display = false; + if (check_msg_scroll) { + msg_scroll = false; + } } } |