diff options
-rw-r--r-- | cmake.deps/deps.txt | 4 | ||||
-rw-r--r-- | src/nvim/decoration.c | 12 | ||||
-rw-r--r-- | src/nvim/drawscreen.c | 2 | ||||
-rw-r--r-- | src/nvim/undo.c | 4 | ||||
-rw-r--r-- | test/functional/ui/sign_spec.lua | 26 |
5 files changed, 38 insertions, 10 deletions
diff --git a/cmake.deps/deps.txt b/cmake.deps/deps.txt index 19ccc851cb..bb6de015ef 100644 --- a/cmake.deps/deps.txt +++ b/cmake.deps/deps.txt @@ -47,8 +47,8 @@ TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.1 TREESITTER_LUA_SHA256 974230f212d0049fce8e881b88b18eebbd05f1fd0edd16fe4ba5bdd2bcd78d08 TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz TREESITTER_VIM_SHA256 403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2 -TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.1.tar.gz -TREESITTER_VIMDOC_SHA256 61e165df29778dc0c9277c2a7bc67447cc4e1bed36ca916a2f476dd25ce3260e +TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.1.0.tar.gz +TREESITTER_VIMDOC_SHA256 71af795090ff50638904f27b8888ba1c0c2be91b7b60b0a6f2d6d6a138150e02 TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz TREESITTER_QUERY_SHA256 e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c TREESITTER_PYTHON_URL https://github.com/tree-sitter/tree-sitter-python/archive/v0.20.4.tar.gz diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index ddc4708740..7cce6b3ad1 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -840,14 +840,14 @@ void buf_signcols_count_range(buf_T *buf, int row1, int row2, int add, TriState // For each row increment "b_signcols.count" at the number of counted signs, // and decrement at the previous number of signs. These two operations are - // split in separate calls if "clear" is not kNone (surrounding a marktree splice). + // split in separate calls if "clear" is not kFalse (surrounding a marktree splice). for (int i = 0; i < row2 + 1 - row1; i++) { - int width = MIN(SIGN_SHOW_MAX, count[i] - add); - if (clear != kNone && width > 0) { - buf->b_signcols.count[width - 1]--; - assert(buf->b_signcols.count[width - 1] >= 0); + int prevwidth = MIN(SIGN_SHOW_MAX, count[i] - add); + if (clear != kNone && prevwidth > 0) { + buf->b_signcols.count[prevwidth - 1]--; + assert(buf->b_signcols.count[prevwidth - 1] >= 0); } - width = MIN(SIGN_SHOW_MAX, count[i]); + int width = MIN(SIGN_SHOW_MAX, count[i]); if (clear != kTrue && width > 0) { buf->b_signcols.count[width - 1]++; if (width > buf->b_signcols.max) { diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 8341989ab0..9a3fffde07 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1206,7 +1206,7 @@ static bool win_redraw_signcols(win_T *wp) if (!buf->b_signcols.autom && (*wp->w_p_stc != NUL || (wp->w_maxscwidth > 1 && wp->w_minscwidth != wp->w_maxscwidth))) { buf->b_signcols.autom = true; - buf_signcols_count_range(buf, 0, buf->b_ml.ml_line_count, MAXLNUM, kNone); + buf_signcols_count_range(buf, 0, buf->b_ml.ml_line_count, MAXLNUM, kFalse); } while (buf->b_signcols.max > 0 && buf->b_signcols.count[buf->b_signcols.max - 1] == 0) { diff --git a/src/nvim/undo.c b/src/nvim/undo.c index d343fb5fa0..d517f07b32 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2389,7 +2389,9 @@ static void u_undoredo(bool undo, bool do_buf_event) // When text has been changed, possibly the start of the next line // may have SpellCap that should be removed or it needs to be // displayed. Schedule the next line for redrawing just in case. - if (spell_check_window(curwin) && bot <= curbuf->b_ml.ml_line_count) { + // Also just in case the line had a sign which needs to be removed. + if ((spell_check_window(curwin) || curbuf->b_signs_with_text) + && bot <= curbuf->b_ml.ml_line_count) { redrawWinline(curwin, bot); } diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 5e45c3113b..af03bce4a0 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -539,4 +539,30 @@ describe('Signs', function() | ]]) end) + + it('no negative b_signcols.count with undo after initializing', function() + exec([[ + set signcolumn=auto:2 + call setline(1, 'a') + call nvim_buf_set_extmark(0, nvim_create_namespace(''), 0, 0, {'sign_text':'S1'}) + delete | redraw | undo + ]]) + end) + + it('sign not shown on line it was previously on after undo', function() + exec([[ + call setline(1, range(1, 4)) + call nvim_buf_set_extmark(0, nvim_create_namespace(''), 1, 0, {'sign_text':'S1'}) + ]]) + exec('norm 2Gdd') + exec('silent undo') + screen:expect([[ + {2: }1 | + S1^2 | + {2: }3 | + {2: }4 | + {0:~ }|*9 + | + ]]) + end) end) |