diff options
author | Jaehwang Jung <tomtomjhj@gmail.com> | 2023-09-12 04:29:39 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-11 12:29:39 -0700 |
commit | 65738202f8be3ca63b75197d48f2c7a9324c035b (patch) | |
tree | af84592f43cac667a06c50d005f726a31492677c /src/nvim/api/extmark.c | |
parent | f859d16aea0d58e572edc9aaf1de3542569e10a9 (diff) | |
download | rneovim-65738202f8be3ca63b75197d48f2c7a9324c035b.tar.gz rneovim-65738202f8be3ca63b75197d48f2c7a9324c035b.tar.bz2 rneovim-65738202f8be3ca63b75197d48f2c7a9324c035b.zip |
fix(decorations): better approximation of botline #24794
Problem:
* The guessed botline might be smaller than the actual botline e.g. when
there are folds and the user is typing in insert mode. This may result
in incorrect treesitter highlights for injections.
* botline can be larger than the last line number of the buffer, which
results in errors when placing extmarks.
Solution:
* Take a more conservative approximation. I am not sure if it is
sufficient to guarantee correctness, but it seems to be good enough
for the case mentioned above.
* Clamp it to the last line number.
Co-authored-by: Lewis Russell <me@lewisr.dev>
Diffstat (limited to 'src/nvim/api/extmark.c')
-rw-r--r-- | src/nvim/api/extmark.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index 6ec1fc4ee0..268fdded9a 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -1035,7 +1035,8 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start, /// window callbacks) /// ["buf", bufnr, tick] /// - on_win: called when starting to redraw a -/// specific window. +/// specific window. botline_guess is an approximation +/// that does not exceed the last line number. /// ["win", winid, bufnr, topline, botline_guess] /// - on_line: called for each buffer line being redrawn. /// (The interaction with fold lines is subject to change) |