diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-02-20 17:39:40 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2022-02-24 22:36:00 +0000 |
commit | 9d53791cf8aa170f4a3b569ddbae43d6f1132af0 (patch) | |
tree | ac9cb0ce1600d5d25946d0ccb89c6a3ec242ae0c | |
parent | eb6e5d09910dc80932f91135f83957bd96efc3a9 (diff) | |
download | rneovim-9d53791cf8aa170f4a3b569ddbae43d6f1132af0.tar.gz rneovim-9d53791cf8aa170f4a3b569ddbae43d6f1132af0.tar.bz2 rneovim-9d53791cf8aa170f4a3b569ddbae43d6f1132af0.zip |
fix(signcol): update cursor when signcol changes
Fixes #14195
-rw-r--r-- | src/nvim/screen.c | 20 | ||||
-rw-r--r-- | test/functional/ui/sign_spec.lua | 6 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index dcc4722b0d..7fafe3dd6e 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -326,6 +326,18 @@ void redraw_buf_status_later(buf_T *buf) } } +void redraw_win_signcol(win_T *wp) +{ + // If we can compute a change in the automatic sizing of the sign column + // under 'signcolumn=auto:X' and signs currently placed in the buffer, better + // figuring it out here so we can redraw the entire screen for it. + int scwidth = wp->w_scwidth; + wp->w_scwidth = win_signcol_count(wp); + if (wp->w_scwidth != scwidth) { + changed_line_abv_curs_win(wp); + } +} + /// Redraw the parts of the screen that is marked for redraw. /// /// Most code shouldn't call this directly, rather use redraw_later() and @@ -790,12 +802,6 @@ static void win_update(win_T *wp, Providers *providers) linenr_T mod_bot = 0; int save_got_int; - - // If we can compute a change in the automatic sizing of the sign column - // under 'signcolumn=auto:X' and signs currently placed in the buffer, better - // figuring it out here so we can redraw the entire screen for it. - wp->w_scwidth = win_signcol_count(wp); - type = wp->w_redr_type; if (type >= NOT_VALID) { @@ -817,6 +823,8 @@ static void win_update(win_T *wp, Providers *providers) return; } + redraw_win_signcol(wp); + init_search_hl(wp); /* Force redraw when width of 'number' or 'relativenumber' column diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index a0b7c98c51..f718786557 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -446,7 +446,7 @@ describe('Signs', function() {1:>>>>>>>>}{6: 1 }a | {2: }{6: 2 }b | {2: }{6: 3 }c | - {2: }{6:^ 4 } | + {2: }{6: 4 }^ | {0:~ }| {0:~ }| {0:~ }| @@ -468,7 +468,7 @@ describe('Signs', function() {1:>>>>>>>>>>}{6: 1 }a | {2: }{6: 2 }b | {2: }{6: 3 }c | - {2: ^ }{6: 4 } | + {2: }{6: 4 }^ | {0:~ }| {0:~ }| {0:~ }| @@ -512,7 +512,7 @@ describe('Signs', function() {1:>>}{6: 1 }a | {2: }{6: 2 }b | {2: }{6: 3 }c | - {2: }{6: ^4 } | + {2: }{6: 4 }^ | {0:~ }| {0:~ }| {0:~ }| |