diff options
author | luukvbaal <luukvbaal@gmail.com> | 2023-12-26 02:07:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-26 09:07:58 +0800 |
commit | ec7453804421f738955a5f4460f44172318d42ff (patch) | |
tree | eebaf83158ea74fa2bef326ae3d3b35fa623f5a7 /src | |
parent | bbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca (diff) | |
download | rneovim-ec7453804421f738955a5f4460f44172318d42ff.tar.gz rneovim-ec7453804421f738955a5f4460f44172318d42ff.tar.bz2 rneovim-ec7453804421f738955a5f4460f44172318d42ff.zip |
fix(column): correct width after truncated 'statuscolumn' error (#26737)
Problem: Default number column has incorrect width after 'statuscolumn'
is unset due to an error, but was also truncated.
Solution: Reverse 'statuscolumn' error and truncate return branches.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/drawline.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 885d308514..24714e2d6e 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -640,12 +640,12 @@ static void draw_statuscol(win_T *wp, winlinevars_T *wlv, linenr_T lnum, int vir int width = build_statuscol_str(wp, lnum, relnum, buf, 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 > 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 + if (*wp->w_p_stc == NUL) { // 'statuscolumn' reset due to error wp->w_nrwidth_line_count = 0; wp->w_nrwidth = (wp->w_p_nu || wp->w_p_rnu) * number_width(wp); + } else { // Avoid truncating 'statuscolumn' + wp->w_nrwidth_width = wp->w_nrwidth; + wp->w_nrwidth = MIN(MAX_NUMBERWIDTH, wp->w_nrwidth + stcp->truncate); } wp->w_redr_statuscol = true; return; |