From 3de785e7b58e4d99e02382881767934efcd0f82c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 2 Aug 2018 08:31:04 -0400 Subject: fold: add const to hasFoldingWin() variables cache is bool so update callers to pass true/false, not TRUE/FALSE. --- src/nvim/screen.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index be45c1573c..24ea221c78 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -783,16 +783,18 @@ static void win_update(win_T *wp) } } - (void)hasFoldingWin(wp, mod_top, &mod_top, NULL, TRUE, NULL); - if (mod_top > lnumt) + (void)hasFoldingWin(wp, mod_top, &mod_top, NULL, true, NULL); + if (mod_top > lnumt) { mod_top = lnumt; + } - /* Now do the same for the bottom line (one above mod_bot). */ - --mod_bot; - (void)hasFoldingWin(wp, mod_bot, NULL, &mod_bot, TRUE, NULL); - ++mod_bot; - if (mod_bot < lnumb) + // Now do the same for the bottom line (one above mod_bot). + mod_bot--; + (void)hasFoldingWin(wp, mod_bot, NULL, &mod_bot, true, NULL); + mod_bot++; + if (mod_bot < lnumb) { mod_bot = lnumb; + } } /* When a change starts above w_topline and the end is below @@ -876,7 +878,7 @@ static void win_update(win_T *wp) ++j; if (j >= wp->w_height - 2) break; - (void)hasFoldingWin(wp, ln, NULL, &ln, TRUE, NULL); + (void)hasFoldingWin(wp, ln, NULL, &ln, true, NULL); } } else j = wp->w_lines[0].wl_lnum - wp->w_topline; @@ -1307,15 +1309,15 @@ static void win_update(win_T *wp) /* Able to count old number of rows: Count new window * rows, and may insert/delete lines */ j = idx; - for (l = lnum; l < mod_bot; ++l) { - if (hasFoldingWin(wp, l, NULL, &l, TRUE, NULL)) - ++new_rows; - else if (l == wp->w_topline) - new_rows += plines_win_nofill(wp, l, TRUE) - + wp->w_topfill; - else - new_rows += plines_win(wp, l, TRUE); - ++j; + for (l = lnum; l < mod_bot; l++) { + if (hasFoldingWin(wp, l, NULL, &l, true, NULL)) { + new_rows++; + } else if (l == wp->w_topline) { + new_rows += plines_win_nofill(wp, l, true) + wp->w_topfill; + } else { + new_rows += plines_win(wp, l, true); + } + j++; if (new_rows > wp->w_height - row - 2) { /* it's getting too much, must redraw the rest */ new_rows = 9999; @@ -5525,10 +5527,12 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum) && re_multiline(shl->rm.regprog)) { if (shl->first_lnum == 0) { for (shl->first_lnum = lnum; - shl->first_lnum > wp->w_topline; --shl->first_lnum) - if (hasFoldingWin(wp, shl->first_lnum - 1, - NULL, NULL, TRUE, NULL)) + shl->first_lnum > wp->w_topline; + shl->first_lnum--) { + if (hasFoldingWin(wp, shl->first_lnum - 1, NULL, NULL, true, NULL)) { break; + } + } } if (cur != NULL) { cur->pos.cur = 0; -- cgit