diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-04-19 00:19:26 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2023-04-19 03:22:27 +0200 |
commit | 44d4f0357341d661a8fa7bd88c244e0ab196a838 (patch) | |
tree | c6c0bd1e80bd9baed4c597c20de658c38d062458 | |
parent | d799456a6b4d9f3000a4a4adb8b71ddee96351b9 (diff) | |
download | rneovim-44d4f0357341d661a8fa7bd88c244e0ab196a838.tar.gz rneovim-44d4f0357341d661a8fa7bd88c244e0ab196a838.tar.bz2 rneovim-44d4f0357341d661a8fa7bd88c244e0ab196a838.zip |
fix(column): rebuild status column when sign column is invalid
-rw-r--r-- | src/nvim/drawscreen.c | 5 | ||||
-rw-r--r-- | src/nvim/option.c | 12 | ||||
-rw-r--r-- | src/nvim/optionstr.c | 4 | ||||
-rw-r--r-- | test/functional/ui/statuscolumn_spec.lua | 8 |
4 files changed, 20 insertions, 9 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 810175aeba..71dbbdabfc 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1397,10 +1397,6 @@ static void win_update(win_T *wp, DecorProviders *providers) if (type >= UPD_NOT_VALID) { wp->w_redr_status = true; wp->w_lines_valid = 0; - if (*wp->w_p_stc != NUL) { - wp->w_nrwidth_line_count = 0; // make sure width is reset - wp->w_statuscol_line_count = 0; // make sure width is re-estimated - } } // Window is zero-height: Only need to draw the separator @@ -2528,6 +2524,7 @@ int number_width(win_T *wp) // reset for 'statuscolumn' if (*wp->w_p_stc != NUL) { + wp->w_statuscol_line_count = 0; // make sure width is re-estimated wp->w_nrwidth_width = (wp->w_p_nu || wp->w_p_rnu) * (int)wp->w_p_nuw; return wp->w_nrwidth_width; } diff --git a/src/nvim/option.c b/src/nvim/option.c index 3b674ce726..5466dc97e9 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2189,9 +2189,8 @@ static const char *set_bool_option(const int opt_idx, char *const varp, const in 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 + // When 'number' is changed and 'statuscolumn' is set, make sure width is reset. + curwin->w_nrwidth_line_count = 0; } if ((int *)varp == &curwin->w_p_arab) { @@ -5531,6 +5530,13 @@ int win_signcol_configured(win_T *wp, int *is_fixed) if (*scl == 'n' && (*(scl + 1) == 'o' || (*(scl + 1) == 'u' && (wp->w_p_nu || wp->w_p_rnu)))) { + if (!wp->w_buffer->b_signcols.valid) { + FOR_ALL_WINDOWS_IN_TAB(win, curtab) { + if (*win->w_p_stc != NUL) { + win->w_nrwidth_line_count = 0; + } + } + } if (*wp->w_p_stc != NUL) { buf_signcols(wp->w_buffer, 0); } diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 6c6190cb08..1f3fb942ff 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -1202,8 +1202,8 @@ static void did_set_statusline(win_T *win, char **varp, char **gvarp, const char if (varp == &p_ruf) { // reset ru_wid first ru_wid = 0; } else if (varp == &win->w_p_stc) { - win->w_nrwidth_line_count = 0; // make sure width is reset - win->w_statuscol_line_count = 0; // make sure width is re-estimated + // reset 'statuscolumn' width + win->w_nrwidth_line_count = 0; } char *s = *varp; if (varp == &p_ruf && *s == '%') { diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index 886e264a5f..c4b055d289 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -648,6 +648,14 @@ describe('statuscolumn', function() 2 aaaaa | | ]]) + -- In all windows + command('wincmd v | set ls=0') + command('sign place 1 line=2 name=sign') + screen:expect([[ + 1 ^aaaaa │1 aaaaa | + 2 ssaaaaa │2 ssaaaaa | + | + ]]) end) it("is only evaluated twice, once to estimate and once to draw", function() |