diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/drawline.c | 2 | ||||
-rw-r--r-- | src/nvim/statusline.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 53e6b157c6..d0cd11ccf3 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -686,7 +686,7 @@ static void get_statuscol_str(win_T *wp, linenr_T lnum, int virtnum, statuscol_T int width = build_statuscol_str(wp, lnum, relnum, stcp); // Force a redraw in case of error or when truncated if (*wp->w_p_stc == NUL || (stcp->truncate > 0 && wp->w_nrwidth < MAX_NUMBERWIDTH)) { - if (stcp->truncate) { // Avoid truncating 'statuscolumn' + if (stcp->truncate > 0) { // Avoid truncating 'statuscolumn' wp->w_nrwidth = MIN(MAX_NUMBERWIDTH, wp->w_nrwidth + stcp->truncate); wp->w_nrwidth_width = wp->w_nrwidth; } else { // 'statuscolumn' reset due to error diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index b01febc18c..b1c7cbb8dc 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -890,7 +890,9 @@ void draw_tabline(void) /// @return The width of the built status column string for line "lnum" int build_statuscol_str(win_T *wp, linenr_T lnum, long relnum, statuscol_T *stcp) { - bool fillclick = relnum >= 0 && lnum == wp->w_topline; + // Only update click definitions once per window per redraw. + // Don't update when current width is 0, since it will be redrawn again if not empty. + const bool fillclick = relnum >= 0 && stcp->width > 0 && lnum == wp->w_topline; if (relnum >= 0) { set_vim_var_nr(VV_LNUM, lnum); @@ -903,7 +905,6 @@ int build_statuscol_str(win_T *wp, linenr_T lnum, long relnum, statuscol_T *stcp stcp->width, &stcp->hlrec, fillclick ? &clickrec : NULL, stcp); xfree(stc); - // Only update click definitions once per window per redraw if (fillclick) { stl_clear_click_defs(wp->w_statuscol_click_defs, wp->w_statuscol_click_defs_size); wp->w_statuscol_click_defs = stl_alloc_click_defs(wp->w_statuscol_click_defs, stcp->width, @@ -1973,8 +1974,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n int width = vim_strsize(out); // Return truncated width for 'statuscolumn' - if (stcp != NULL && width > maxwidth) { - stcp->truncate = width - maxwidth; + if (stcp != NULL && width > stcp->width) { + stcp->truncate = width - stcp->width; } if (maxwidth > 0 && width > maxwidth) { // Result is too long, must truncate somewhere. |