aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluukvbaal <31730729+luukvbaal@users.noreply.github.com>2023-04-12 17:40:58 +0200
committerGitHub <noreply@github.com>2023-04-12 16:40:58 +0100
commitcdc028e97d9808c21e26fffe2d282b6517eaffc0 (patch)
tree64497533a75679c39367998da5dff8ebdeac5693 /src
parent1013aba462d0721bafc934eddd1dba672d084958 (diff)
downloadrneovim-cdc028e97d9808c21e26fffe2d282b6517eaffc0.tar.gz
rneovim-cdc028e97d9808c21e26fffe2d282b6517eaffc0.tar.bz2
rneovim-cdc028e97d9808c21e26fffe2d282b6517eaffc0.zip
fix(column): add truncated width during estimation for 'statuscolumn'
Problem: Estimated 'statuscolumn' width estimated is not properly used, executing the `w_redr_statuscol` path unnecessarily. Solution: Adjust `w_nrwidth` and 'statuscolumn' width before anything is actually drawn in a `win_update()`.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawline.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 27e1632559..2268a7cd3e 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -656,7 +656,15 @@ static void get_statuscol_str(win_T *wp, linenr_T lnum, int virtnum, statuscol_T
wp->w_statuscol_line_count = wp->w_nrwidth_line_count;
set_vim_var_nr(VV_VIRTNUM, 0);
build_statuscol_str(wp, wp->w_nrwidth_line_count, 0, stcp);
- stcp->width += stcp->truncate;
+ if (stcp->truncate > 0) {
+ // Add truncated width to avoid unnecessary redraws
+ int addwidth = MIN(stcp->truncate, MAX_NUMBERWIDTH - wp->w_nrwidth);
+ stcp->truncate = 0;
+ stcp->width += addwidth;
+ wp->w_nrwidth += addwidth;
+ wp->w_nrwidth_width = wp->w_nrwidth;
+ wp->w_valid &= ~VALID_WCOL;
+ }
}
set_vim_var_nr(VV_VIRTNUM, virtnum);