aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/screen.lua
diff options
context:
space:
mode:
authorMatthias Deiml <matthias@deiml.net>2023-03-12 23:58:46 +0100
committerGitHub <noreply@github.com>2023-03-12 15:58:46 -0700
commitfd2ece278b0941ec6673489e88868120e86b834a (patch)
treeaf318b0e355797ee3086037d52e2203492d13ddc /test/functional/ui/screen.lua
parente5f4394eb7a27a9e5eaab088e6acf5553c64cf59 (diff)
downloadrneovim-fd2ece278b0941ec6673489e88868120e86b834a.tar.gz
rneovim-fd2ece278b0941ec6673489e88868120e86b834a.tar.bz2
rneovim-fd2ece278b0941ec6673489e88868120e86b834a.zip
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
Diffstat (limited to 'test/functional/ui/screen.lua')
-rw-r--r--test/functional/ui/screen.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index e5a449fa66..f5ae9c8e89 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -803,14 +803,17 @@ function Screen:_handle_win_pos(grid, win, startrow, startcol, width, height)
self.float_pos[grid] = nil
end
-function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol, linecount)
+function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol, linecount, scroll_delta)
+ -- accumulate scroll delta
+ local last_scroll_delta = self.win_viewport[grid] and self.win_viewport[grid].sum_scroll_delta or 0
self.win_viewport[grid] = {
win = win,
topline = topline,
botline = botline,
curline = curline,
curcol = curcol,
- linecount = linecount
+ linecount = linecount,
+ sum_scroll_delta = scroll_delta + last_scroll_delta
}
end
@@ -1348,7 +1351,7 @@ local function fmt_ext_state(name, state)
for k,v in pairs(state) do
str = (str.." ["..k.."] = {win = {id = "..v.win.id.."}, topline = "
..v.topline..", botline = "..v.botline..", curline = "..v.curline
- ..", curcol = "..v.curcol..", linecount = "..v.linecount.."};\n")
+ ..", curcol = "..v.curcol..", linecount = "..v.linecount..", scroll_delta = "..v.scroll_delta.."};\n")
end
return str .. "}"
elseif name == "float_pos" then