aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/extmark.c
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-12-25 02:31:47 +0900
committerLewis Russell <me@lewisr.dev>2024-01-04 11:37:00 +0000
commitdc48a98f9ac614dc94739637c967aa29e064807e (patch)
treeb53348803c82a132b51077eca3200f3aa36cc513 /src/nvim/api/extmark.c
parent9b90657376754a492d19f1daaffb257bf87d09cf (diff)
downloadrneovim-dc48a98f9ac614dc94739637c967aa29e064807e.tar.gz
rneovim-dc48a98f9ac614dc94739637c967aa29e064807e.tar.bz2
rneovim-dc48a98f9ac614dc94739637c967aa29e064807e.zip
fix(decorations): validate botline for on_win
Problem: Many decoration providers (treesitter injection highlighting, semantic token highlighting, inlay hint) rely on the correctness of the `botline` argument of `on_win` callback. However, `botline` can be smaller than the actual line number of the last displayed line if some lines are folded. In such cases, some decorations will be missing in the lines not covered by `botline`. Solution: Validate `botline` when invoking `on_win`. NOTE: It seems that the old code was deliberately avoiding this presumably due to performance reasons. However, I haven't experienced noticeable lag after this change, and I believe the cost of botline computation would be much smaller than the cost of decoration providers.
Diffstat (limited to 'src/nvim/api/extmark.c')
-rw-r--r--src/nvim/api/extmark.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 0cf16294b6..e66e25e527 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -1009,10 +1009,8 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
/// - on_buf: called for each buffer being redrawn (before
/// window callbacks)
/// ["buf", bufnr, tick]
-/// - on_win: called when starting to redraw a
-/// specific window. botline_guess is an approximation
-/// that does not exceed the last line number.
-/// ["win", winid, bufnr, topline, botline_guess]
+/// - on_win: called when starting to redraw a specific window.
+/// ["win", winid, bufnr, topline, botline]
/// - on_line: called for each buffer line being redrawn.
/// (The interaction with fold lines is subject to change)
/// ["win", winid, bufnr, row]