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".)
This commit is contained in:
luukvbaal
2023-03-07 01:45:08 +01:00
committed by GitHub
parent 39096f48f0
commit bf4eada2c8
3 changed files with 43 additions and 0 deletions

View File

@@ -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) {