diff options
author | luukvbaal <31730729+luukvbaal@users.noreply.github.com> | 2023-03-07 01:45:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 08:45:08 +0800 |
commit | bf4eada2c83f5402fc56370fd22af11029a4a3aa (patch) | |
tree | dc9c8e9ac0f61f7530ac7b6c26dc415bbce63c0b /src | |
parent | 39096f48f0a632870f0792955b37dc32e77458fb (diff) | |
download | rneovim-bf4eada2c83f5402fc56370fd22af11029a4a3aa.tar.gz rneovim-bf4eada2c83f5402fc56370fd22af11029a4a3aa.tar.bz2 rneovim-bf4eada2c83f5402fc56370fd22af11029a4a3aa.zip |
fix(column): issues with 'statuscolumn' width (#22542)
Problem: 'statuscolumn' width can be incorrect when toggling 'number'
or setting 'statuscolumn'.
Solution: Make sure the width is reset and re-estimated when
'statuscolumn' and 'number' are set. (When 'relativenumber'
is set this already happens because it always changes
"nrwidth_line_count".)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 4 | ||||
-rw-r--r-- | src/nvim/optionstr.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index be82cf22c7..5ad2929a91 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2176,6 +2176,10 @@ static char *set_bool_option(const int opt_idx, char *const varp, const int valu if (curwin->w_p_spell) { errmsg = did_set_spelllang(curwin); } + } else if ((int *)varp == &curwin->w_p_nu && *curwin->w_p_stc != NUL) { + // When 'statuscolumn' is set and 'number' is changed: + curwin->w_nrwidth_line_count = 0; // make sure width is reset + curwin->w_statuscol_line_count = 0; // make sure width is re-estimated } if ((int *)varp == &curwin->w_p_arab) { diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index f903ad3d09..b335e255a4 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -1199,6 +1199,7 @@ static void did_set_statusline(win_T *win, char **varp, char **gvarp, char **err ru_wid = 0; } else if (varp == &win->w_p_stc) { win->w_nrwidth_line_count = 0; + win->w_statuscol_line_count = 0; } char *s = *varp; if (varp == &p_ruf && *s == '%') { |