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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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. • 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* REMOVED FEATURES *news-removed*

View File

@ -626,11 +626,15 @@ tabs.
When |ui-messages| is active, no message grid is used, and this event When |ui-messages| is active, no message grid is used, and this event
will not be sent. 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 Indicates the range of buffer text displayed in the window, as well
as the cursor position in the buffer. All positions are zero-based. 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 `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] ~ ["win_extmark", grid, win, ns_id, mark_id, row, col] ~
Updates the position of an extmark which is currently visible in a Updates the position of an extmark which is currently visible in a

View File

@ -114,7 +114,7 @@ void msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep_char)
FUNC_API_SINCE(6) FUNC_API_COMPOSITOR_IMPL FUNC_API_CLIENT_IGNORE; FUNC_API_SINCE(6) FUNC_API_COMPOSITOR_IMPL FUNC_API_CLIENT_IGNORE;
void win_viewport(Integer grid, Window win, Integer topline, Integer botline, Integer curline, void win_viewport(Integer grid, Window win, Integer topline, Integer botline, Integer curline,
Integer curcol, Integer line_count) Integer curcol, Integer line_count, Integer scroll_delta)
FUNC_API_SINCE(7) FUNC_API_CLIENT_IGNORE; FUNC_API_SINCE(7) FUNC_API_CLIENT_IGNORE;
void win_extmark(Integer grid, Window win, Integer ns_id, Integer mark_id, Integer row, Integer col) void win_extmark(Integer grid, Window win, Integer ns_id, Integer mark_id, Integer row, Integer col)

View File

@ -1222,6 +1222,7 @@ struct window_S {
colnr_T w_valid_leftcol; // last known w_leftcol colnr_T w_valid_leftcol; // last known w_leftcol
bool w_viewport_invalid; bool w_viewport_invalid;
linenr_T w_viewport_last_topline; // topline when the viewport was last updated
// w_cline_height is the number of physical lines taken by the buffer line // w_cline_height is the number of physical lines taken by the buffer line
// that the cursor is on. We use this to avoid extra calls to plines_win(). // that the cursor is on. We use this to avoid extra calls to plines_win().

View File

@ -993,10 +993,22 @@ void ui_ext_win_viewport(win_T *wp)
// interact with incomplete final line? Diff filler lines? // interact with incomplete final line? Diff filler lines?
botline = wp->w_buffer->b_ml.ml_line_count; botline = wp->w_buffer->b_ml.ml_line_count;
} }
int scroll_delta = 0;
if (wp->w_viewport_last_topline > line_count) {
scroll_delta -= wp->w_viewport_last_topline - line_count;
wp->w_viewport_last_topline = line_count;
}
if (wp->w_topline < wp->w_viewport_last_topline) {
scroll_delta -= plines_m_win(wp, wp->w_topline, wp->w_viewport_last_topline - 1);
} else if (wp->w_topline > wp->w_viewport_last_topline
&& wp->w_topline <= line_count) {
scroll_delta += plines_m_win(wp, wp->w_viewport_last_topline, wp->w_topline - 1);
}
ui_call_win_viewport(wp->w_grid_alloc.handle, wp->handle, wp->w_topline - 1, ui_call_win_viewport(wp->w_grid_alloc.handle, wp->handle, wp->w_topline - 1,
botline, wp->w_cursor.lnum - 1, wp->w_cursor.col, botline, wp->w_cursor.lnum - 1, wp->w_cursor.col,
line_count); line_count, scroll_delta);
wp->w_viewport_invalid = false; wp->w_viewport_invalid = false;
wp->w_viewport_last_topline = wp->w_topline;
} }
} }
@ -5038,6 +5050,7 @@ static win_T *win_alloc(win_T *after, bool hidden)
new_wp->w_floating = 0; new_wp->w_floating = 0;
new_wp->w_float_config = FLOAT_CONFIG_INIT; new_wp->w_float_config = FLOAT_CONFIG_INIT;
new_wp->w_viewport_invalid = true; new_wp->w_viewport_invalid = true;
new_wp->w_viewport_last_topline = 1;
new_wp->w_ns_hl = -1; new_wp->w_ns_hl = -1;

View File

@ -1241,7 +1241,7 @@ describe('cmdheight=0', function()
{1:~ }| {1:~ }|
## grid 3 ## grid 3
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
feed '/p' feed '/p'
@ -1261,7 +1261,7 @@ describe('cmdheight=0', function()
## grid 3 ## grid 3
/p^ | /p^ |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
end) end)

View File

@ -1433,8 +1433,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1476,8 +1476,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1519,8 +1519,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1562,8 +1562,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1606,8 +1606,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1647,8 +1647,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1688,8 +1688,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1731,8 +1731,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1781,8 +1781,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6}; [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1868,8 +1868,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1911,8 +1911,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1954,8 +1954,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -1997,8 +1997,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 2, 5, true } [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -2048,8 +2048,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 0, 0, true } [4] = { { id = 1001 }, "NW", 1, 0, 0, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -2106,8 +2106,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = { { id = 1002 }, "NW", 1, 0, 5, true } [5] = { { id = 1002 }, "NW", 1, 0, 5, true }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -2165,8 +2165,8 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 }, [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 },
[6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 } [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -2618,7 +2618,8 @@ describe('float window', function()
curline = 0, curline = 0,
curcol = 3, curcol = 3,
linecount = 2, linecount = 2,
win = { id = 1000 } sum_scroll_delta = 0,
win = { id = 1000 },
}, },
[4] = { [4] = {
topline = 0, topline = 0,
@ -2626,6 +2627,7 @@ describe('float window', function()
curline = 0, curline = 0,
curcol = 3, curcol = 3,
linecount = 2, linecount = 2,
sum_scroll_delta = 0,
win = { id = 1001 } win = { id = 1001 }
}, },
[5] = { [5] = {
@ -2634,6 +2636,7 @@ describe('float window', function()
curline = 0, curline = 0,
curcol = 0, curcol = 0,
linecount = 1, linecount = 1,
sum_scroll_delta = 0,
win = { id = 1002 } win = { id = 1002 }
} }
}} }}
@ -7149,8 +7152,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 2, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
meths.input_mouse('left', 'press', '', 5, 0, 0) meths.input_mouse('left', 'press', '', 5, 0, 0)
@ -7179,8 +7182,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 2, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
meths.input_mouse('left', 'drag', '', 5, 1, 2) meths.input_mouse('left', 'drag', '', 5, 1, 2)
@ -7209,8 +7212,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 2, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -7279,8 +7282,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
meths.input_mouse('left', 'press', '', 5, 1, 1) meths.input_mouse('left', 'press', '', 5, 1, 1)
@ -7311,8 +7314,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
meths.input_mouse('left', 'drag', '', 5, 2, 3) meths.input_mouse('left', 'drag', '', 5, 2, 3)
@ -7343,8 +7346,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 0, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 0, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -7413,8 +7416,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 1, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 1, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
meths.input_mouse('left', 'press', '', 5, 1, 0) meths.input_mouse('left', 'press', '', 5, 1, 0)
@ -7444,8 +7447,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 1, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 1, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
}} }}
meths.input_mouse('left', 'drag', '', 5, 2, 2) meths.input_mouse('left', 'drag', '', 5, 2, 2)
@ -7475,8 +7478,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "NW", 1, 1, 5, true, 50}; [5] = {{id = 1002}, "NW", 1, 1, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 1, curcol = 2, linecount = 3, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8228,8 +8231,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true }; [4] = { { id = 1001 }, "NW", 1, 2, 5, true };
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8285,10 +8288,10 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 3, 8, true }; [5] = { { id = 1002 }, "NW", 1, 3, 8, true };
[6] = { { id = 1003 }, "NW", 1, 4, 10, true }; [6] = { { id = 1003 }, "NW", 1, 4, 10, true };
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1}; [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8333,8 +8336,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[4] = { { id = 1001 }, "NW", 1, 2, 5, true }; [4] = { { id = 1001 }, "NW", 1, 2, 5, true };
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8390,10 +8393,10 @@ describe('float window', function()
[5] = { { id = 1002 }, "NW", 1, 4, 10, true }; [5] = { { id = 1002 }, "NW", 1, 4, 10, true };
[6] = { { id = 1003 }, "NW", 1, 3, 8, true }; [6] = { { id = 1003 }, "NW", 1, 3, 8, true };
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8453,10 +8456,10 @@ describe('float window', function()
[5] = {{id = 1002}, "NW", 1, 2, 6, true, 50}; [5] = {{id = 1002}, "NW", 1, 2, 6, true, 50};
[6] = {{id = 1003}, "NW", 1, 3, 7, true, 40}; [6] = {{id = 1003}, "NW", 1, 3, 7, true, 40};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8502,8 +8505,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[4] = {{id = 1001}, "NW", 1, 1, 5, true, 50}; [4] = {{id = 1001}, "NW", 1, 1, 5, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8549,8 +8552,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[4] = {{id = 1001}, "NW", 1, 0, 4, true, 50}; [4] = {{id = 1001}, "NW", 1, 0, 4, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8604,8 +8607,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "SW", 1, 9, 0, true, 50}; [5] = {{id = 1002}, "SW", 1, 9, 0, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8658,8 +8661,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "SW", 1, 9, 0, true, 50}; [5] = {{id = 1002}, "SW", 1, 9, 0, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8701,7 +8704,7 @@ describe('float window', function()
{0:~ }| {0:~ }|
## grid 3 ## grid 3
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8756,8 +8759,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "SW", 1, 8, 0, true, 50}; [5] = {{id = 1002}, "SW", 1, 8, 0, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8816,8 +8819,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "SW", 1, 8, 0, true, 50}; [5] = {{id = 1002}, "SW", 1, 8, 0, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8865,8 +8868,8 @@ describe('float window', function()
]], float_pos={ ]], float_pos={
[5] = {{id = 1002}, "SW", 1, 8, 0, true, 50}; [5] = {{id = 1002}, "SW", 1, 8, 0, true, 50};
}, win_viewport={ }, win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[
@ -8907,7 +8910,7 @@ describe('float window', function()
## grid 3 ## grid 3
| |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
else else
screen:expect{grid=[[ screen:expect{grid=[[

View File

@ -2127,7 +2127,7 @@ describe('ext_multigrid', function()
## grid 3 ## grid 3
| |
]], win_viewport={ ]], win_viewport={
[2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1} [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}
}} }}
insert([[ insert([[
Lorem ipsum dolor sit amet, consectetur Lorem ipsum dolor sit amet, consectetur
@ -2162,7 +2162,7 @@ describe('ext_multigrid', function()
## grid 3 ## grid 3
| |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11}, [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5},
}} }}
@ -2187,7 +2187,7 @@ describe('ext_multigrid', function()
## grid 3 ## grid 3
| |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11}, [2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 2},
}} }}
command("split") command("split")
@ -2211,8 +2211,8 @@ describe('ext_multigrid', function()
reprehenderit in voluptate velit esse cillum | reprehenderit in voluptate velit esse cillum |
^dolore eu fugiat nulla pariatur. Excepteur sint | ^dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11}, [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11}, [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 5},
}} }}
feed("b") feed("b")
@ -2236,8 +2236,8 @@ describe('ext_multigrid', function()
reprehenderit in voluptate velit esse ^cillum | reprehenderit in voluptate velit esse ^cillum |
dolore eu fugiat nulla pariatur. Excepteur sint | dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11}, [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11}, [4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11, sum_scroll_delta = 5},
}} }}
feed("2k") feed("2k")
@ -2261,8 +2261,8 @@ describe('ext_multigrid', function()
ea commodo consequat. Duis aute irure dolor in | ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum | reprehenderit in voluptate velit esse cillum |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11}, [2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11, sum_scroll_delta = 6},
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11}, [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
}} }}
-- handles non-current window -- handles non-current window
@ -2287,8 +2287,59 @@ describe('ext_multigrid', function()
ea commodo consequat. Duis aute irure dolor in | ea commodo consequat. Duis aute irure dolor in |
reprehenderit in voluptate velit esse cillum | reprehenderit in voluptate velit esse cillum |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11}, [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11}, [4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
}}
-- sum_scroll_delta works with folds
feed('zfj')
screen:expect{grid=[[
## grid 1
[4:------------------------------------------------]|
[4:------------------------------------------------]|
[4:------------------------------------------------]|
{11:[No Name] [+] }|
[2:------------------------------------------------]|
[2:------------------------------------------------]|
{12:[No Name] [+] }|
[3:------------------------------------------------]|
## grid 2
Lorem ipsum dolor sit amet, consectetur |
adipisicing elit, sed do eiusmod tempor |
## grid 3
|
## grid 4
{13:^+-- 2 lines: exercitation ullamco laboris nisi }|
reprehenderit in voluptate velit esse cillum |
dolore eu fugiat nulla pariatur. Excepteur sint |
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
[4] = {win = {id = 1001}, topline = 4, botline = 9, curline = 4, curcol = 38, linecount = 11, sum_scroll_delta = 4},
}}
feed('<c-e>')
screen:expect{grid=[[
## grid 1
[4:------------------------------------------------]|
[4:------------------------------------------------]|
[4:------------------------------------------------]|
{11:[No Name] [+] }|
[2:------------------------------------------------]|
[2:------------------------------------------------]|
{12:[No Name] [+] }|
[3:------------------------------------------------]|
## grid 2
Lorem ipsum dolor sit amet, consectetur |
adipisicing elit, sed do eiusmod tempor |
## grid 3
|
## grid 4
^reprehenderit in voluptate velit esse cillum |
dolore eu fugiat nulla pariatur. Excepteur sint |
occaecat cupidatat non proident, sunt in culpa |
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0},
[4] = {win = {id = 1001}, topline = 6, botline = 10, curline = 6, curcol = 0, linecount = 11, sum_scroll_delta = 5},
}} }}
end) end)
@ -2314,7 +2365,7 @@ describe('ext_multigrid', function()
## grid 3 ## grid 3
| |
]], win_viewport={ ]], win_viewport={
[2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1} [2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}
}} }}
insert([[ insert([[
Lorem ipsum dolor sit amet, consectetur Lorem ipsum dolor sit amet, consectetur
@ -2349,7 +2400,7 @@ describe('ext_multigrid', function()
## grid 3 ## grid 3
| |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11}, [2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11, sum_scroll_delta = 5},
}} }}
meths.input_mouse('left', 'press', '', 1,5, 1) meths.input_mouse('left', 'press', '', 1,5, 1)
@ -2376,7 +2427,7 @@ describe('ext_multigrid', function()
## grid 3 ## grid 3
{7:-- VISUAL --} | {7:-- VISUAL --} |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11}, [2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11, sum_scroll_delta = 6},
}} }}
end) end)
@ -2414,8 +2465,8 @@ describe('ext_multigrid', function()
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
-- XXX: hack to get notifications. Could use next_msg() also. -- XXX: hack to get notifications. Could use next_msg() also.
@ -2459,8 +2510,8 @@ describe('ext_multigrid', function()
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
eq({}, win_pos) eq({}, win_pos)
@ -2497,8 +2548,8 @@ describe('ext_multigrid', function()
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
}} }}
eq({}, win_pos) eq({}, win_pos)
end) end)

View File

@ -803,14 +803,17 @@ function Screen:_handle_win_pos(grid, win, startrow, startcol, width, height)
self.float_pos[grid] = nil self.float_pos[grid] = nil
end 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] = { self.win_viewport[grid] = {
win = win, win = win,
topline = topline, topline = topline,
botline = botline, botline = botline,
curline = curline, curline = curline,
curcol = curcol, curcol = curcol,
linecount = linecount linecount = linecount,
sum_scroll_delta = scroll_delta + last_scroll_delta
} }
end end
@ -1348,7 +1351,7 @@ local function fmt_ext_state(name, state)
for k,v in pairs(state) do for k,v in pairs(state) do
str = (str.." ["..k.."] = {win = {id = "..v.win.id.."}, topline = " str = (str.." ["..k.."] = {win = {id = "..v.win.id.."}, topline = "
..v.topline..", botline = "..v.botline..", curline = "..v.curline ..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 end
return str .. "}" return str .. "}"
elseif name == "float_pos" then elseif name == "float_pos" then

View File

@ -52,7 +52,7 @@ describe('search highlighting', function()
{1:~ }| {1:~ }|
/text^ | /text^ |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 9, linecount = 2}; [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 9, linecount = 2, sum_scroll_delta = 0};
}} }}
end) end)
@ -616,7 +616,7 @@ describe('search highlighting', function()
{1:~ }| {1:~ }|
{4:search hit BOTTOM, continuing at TOP} | {4:search hit BOTTOM, continuing at TOP} |
]], win_viewport={ ]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 11, linecount = 2}; [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 11, linecount = 2, sum_scroll_delta = 0};
}} }}
-- check highlights work also in folds -- check highlights work also in folds