diff options
author | luukvbaal <luukvbaal@gmail.com> | 2023-04-24 16:22:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 15:22:11 +0100 |
commit | bab4bcdefbdad7f175f7f31c230de3d066963542 (patch) | |
tree | e9776ab11d47ffeae39d0109d5837a2f787ccec8 /src/nvim/option.c | |
parent | c1331a65dd12dd1128db5fb136a77218ef7376f1 (diff) | |
download | rneovim-bab4bcdefbdad7f175f7f31c230de3d066963542.tar.gz rneovim-bab4bcdefbdad7f175f7f31c230de3d066963542.tar.bz2 rneovim-bab4bcdefbdad7f175f7f31c230de3d066963542.zip |
fix(column): don't reset 'statuscolumn' width after it has been drawn
Problem: 'statuscolumn' width may be reset after it has been drawn
when multiple windows contain the same buffer. This results
in an offset for the drawn cursor position.
Solution: Loop over all windows (twice) prior to drawing them to
reset the 'statuscolumn' width and validate the sign
column when necessary.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 69e7bb4b21..0ad11fb3cb 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5947,6 +5947,14 @@ int win_signcol_count(win_T *wp) return win_signcol_configured(wp, NULL); } +/// Return true when window "wp" has no sign column. +bool win_no_signcol(win_T *wp) +{ + const char *scl = wp->w_p_scl; + return (*scl == 'n' && (*(scl + 1) == 'o' || (*(scl + 1) == 'u' + && (wp->w_p_nu || wp->w_p_rnu)))); +} + /// Return the number of requested sign columns, based on user / configuration. int win_signcol_configured(win_T *wp, int *is_fixed) { @@ -5956,20 +5964,7 @@ int win_signcol_configured(win_T *wp, int *is_fixed) *is_fixed = 1; } - // Note: It checks "no" or "number" in 'signcolumn' option - 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); - } + if (win_no_signcol(wp)) { return 0; } |