feat(ui): add scroll_delta to win_viewport event #19270

scroll_delta contains how much the top line of a window moved since the
last time win_viewport was emitted. It is expected to be used to
implement smooth scrolling. For this purpose it only counts "virtual" or
"displayed" so folds should count as one line. Because of this it
adds extra information that cannot be computed from the topline
parameter.

Fixes #19227
This commit is contained in:
Matthias Deiml
2023-03-12 23:58:46 +01:00
committed by GitHub
parent e5f4394eb7
commit fd2ece278b
10 changed files with 192 additions and 114 deletions

View File

@@ -223,6 +223,9 @@ The following changes to existing APIs or features add new behavior.
• API calls now show more information about where an exception happened.
• The `win_viewport` UI event now contains information about virtual lines,
meaning that smooth scrolling can now be implemented more consistenlty.
==============================================================================
REMOVED FEATURES *news-removed*

View File

@@ -626,11 +626,15 @@ tabs.
When |ui-messages| is active, no message grid is used, and this event
will not be sent.
["win_viewport", grid, win, topline, botline, curline, curcol] ~
["win_viewport", grid, win, topline, botline, curline, curcol, line_count, scroll_delta] ~
Indicates the range of buffer text displayed in the window, as well
as the cursor position in the buffer. All positions are zero-based.
`botline` is set to one more than the line count of the buffer, if
there are filler lines past the end.
there are filler lines past the end. `scroll_delta` contains how much
the top line of a window moved since `win_viewport` was last emitted.
It is intended to be used to implement smooth scrolling. For this
purpose it only counts "virtual" or "displayed" lines, so folds
only count as one line.
["win_extmark", grid, win, ns_id, mark_id, row, col] ~
Updates the position of an extmark which is currently visible in a