fix(ui-ext): backport win_viewport fixes to release-0.9

This commit is contained in:
zeertzjq
2023-07-25 21:34:10 +08:00
parent 42a735e524
commit d6733abc69
6 changed files with 387 additions and 51 deletions

View File

@@ -199,7 +199,7 @@ the editor.
The following keys are deprecated:
`hl_id`: Use `attr_id` instead.
`hl_lm`: Use `attr_id_lm` instead.
`id_lm`: Use `attr_id_lm` instead.
["option_set", name, value] ~
UI-related option changed, where `name` is one of:
@@ -336,7 +336,7 @@ numerical highlight ids to the actual attributes.
Highlights are always transmitted both for both the RGB format and as
terminal 256-color codes, as the `rgb_attr` and `cterm_attr` parameters
respectively. The |ui-rgb| option has no effect effect anymore.
respectively. The |ui-rgb| option has no effect anymore.
Most external UIs will only need to store and use the `rgb_attr`
attributes.
@@ -352,7 +352,7 @@ numerical highlight ids to the actual attributes.
|ui-hlstate| extension explained below.
["hl_group_set", name, hl_id] ~
The bulitin highlight group `name` was set to use the attributes `hl_id`
The built-in highlight group `name` was set to use the attributes `hl_id`
defined by a previous `hl_attr_define` call. This event is not needed
to render the grids which use attribute ids directly, but is useful
for a UI who want to render its own elements with consistent
@@ -640,7 +640,8 @@ tabs.
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.
only count as one line. When scrolling more than a full screen it is
an approximate value.
All updates, such as `grid_line`, in a batch affects the new viewport,
despite the fact that `win_viewport` is received after the updates.
@@ -723,7 +724,7 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
to distinguish different command lines active at the same time. The
first invoked command line has level 1, the next recursively-invoked
prompt has level 2. A command line invoked from the |cmdline-window|
has a higher level than than the edited command line.
has a higher level than the edited command line.
["cmdline_pos", pos, level] ~
Change the cursor position in the cmdline.

View File

@@ -1223,6 +1223,9 @@ struct window_S {
bool w_viewport_invalid;
linenr_T w_viewport_last_topline; // topline when the viewport was last updated
linenr_T w_viewport_last_botline; // botline when the viewport was last updated
linenr_T w_viewport_last_topfill; // topfill when the viewport was last updated
linenr_T w_viewport_last_skipcol; // skipcol when the viewport was last updated
// 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().

View File

@@ -530,3 +530,68 @@ static int win_nolbr_chartabsize(chartabsize_T *cts, int *headp)
}
return n;
}
/// Get the number of screen lines a range of text will take in window "wp".
///
/// @param[in] start_lnum Starting line number, 1-based inclusive.
/// @param[in] start_vcol >= 0: Starting virtual column index on "start_lnum",
/// 0-based inclusive, rounded down to full screen lines.
/// < 0: Count a full "start_lnum", including filler lines above.
/// @param[in] end_lnum Ending line number, 1-based inclusive.
/// @param[in] end_vcol >= 0: Ending virtual column index on "end_lnum",
/// 0-based exclusive, rounded up to full screen lines.
/// < 0: Count a full "end_lnum", not including filler lines below.
/// @param[out] fill If not NULL, set to the number of filler lines in the range.
int64_t win_text_height(win_T *const wp, const linenr_T start_lnum, const int64_t start_vcol,
const linenr_T end_lnum, const int64_t end_vcol, int64_t *const fill)
{
int width1 = 0;
int width2 = 0;
if (start_vcol >= 0 || end_vcol >= 0) {
width1 = wp->w_width_inner - win_col_off(wp);
width2 = width1 + win_col_off2(wp);
width1 = MAX(width1, 0);
width2 = MAX(width2, 0);
}
int64_t height_sum_fill = 0;
int64_t height_cur_nofill = 0;
int64_t height_sum_nofill = 0;
linenr_T lnum = start_lnum;
if (start_vcol >= 0) {
linenr_T lnum_next = lnum;
const bool folded = hasFoldingWin(wp, lnum, &lnum, &lnum_next, true, NULL);
height_cur_nofill = folded ? 1 : plines_win_nofill(wp, lnum, false);
height_sum_nofill += height_cur_nofill;
const int64_t row_off = (start_vcol < width1 || width2 <= 0)
? 0
: 1 + (start_vcol - width1) / width2;
height_sum_nofill -= MIN(row_off, height_cur_nofill);
lnum = lnum_next + 1;
}
while (lnum <= end_lnum) {
linenr_T lnum_next = lnum;
const bool folded = hasFoldingWin(wp, lnum, &lnum, &lnum_next, true, NULL);
height_sum_fill += win_get_fill(wp, lnum);
height_cur_nofill = folded ? 1 : plines_win_nofill(wp, lnum, false);
height_sum_nofill += height_cur_nofill;
lnum = lnum_next + 1;
}
if (end_vcol >= 0) {
height_sum_nofill -= height_cur_nofill;
const int64_t row_off = end_vcol == 0
? 0
: (end_vcol <= width1 || width2 <= 0)
? 1
: 1 + (end_vcol - width1 + width2 - 1) / width2;
height_sum_nofill += MIN(row_off, height_cur_nofill);
}
if (fill != NULL) {
*fill = height_sum_fill;
}
return height_sum_fill + height_sum_nofill;
}

View File

@@ -990,29 +990,56 @@ void ui_ext_win_viewport(win_T *wp)
// NOTE: The win_viewport command is delayed until the next flush when there are pending updates.
// This ensures that the updates and the viewport are sent together.
if ((wp == curwin || ui_has(kUIMultigrid)) && wp->w_viewport_invalid && wp->w_redr_type == 0) {
int botline = wp->w_botline;
int line_count = wp->w_buffer->b_ml.ml_line_count;
if (botline == line_count + 1 && wp->w_empty_rows == 0) {
const linenr_T line_count = wp->w_buffer->b_ml.ml_line_count;
// Avoid ml_get errors when producing "scroll_delta".
const linenr_T cur_topline = MIN(wp->w_topline, line_count);
const linenr_T cur_botline = MIN(wp->w_botline, line_count);
int64_t delta = 0;
linenr_T last_topline = wp->w_viewport_last_topline;
linenr_T last_botline = wp->w_viewport_last_botline;
int last_topfill = wp->w_viewport_last_topfill;
int64_t last_skipcol = wp->w_viewport_last_skipcol;
if (last_topline > line_count) {
delta -= last_topline - line_count;
last_topline = line_count;
last_topfill = 0;
last_skipcol = MAXCOL;
}
last_botline = MIN(last_botline, line_count);
if (cur_topline < last_topline
|| (cur_topline == last_topline && wp->w_skipcol < last_skipcol)) {
if (last_topline > 0 && cur_botline < last_topline) {
// Scrolling too many lines: only give an approximate "scroll_delta".
delta -= win_text_height(wp, cur_topline, wp->w_skipcol, cur_botline, 0, NULL);
delta -= last_topline - cur_botline;
} else {
delta -= win_text_height(wp, cur_topline, wp->w_skipcol, last_topline, last_skipcol, NULL);
}
} else if (cur_topline > last_topline
|| (cur_topline == last_topline && wp->w_skipcol > last_skipcol)) {
if (last_botline > 0 && cur_topline > last_botline) {
// Scrolling too many lines: only give an approximate "scroll_delta".
delta += win_text_height(wp, last_topline, last_skipcol, last_botline, 0, NULL);
delta += cur_topline - last_botline;
} else {
delta += win_text_height(wp, last_topline, last_skipcol, cur_topline, wp->w_skipcol, NULL);
}
}
delta += last_topfill;
delta -= wp->w_topfill;
linenr_T ev_botline = wp->w_botline;
if (ev_botline == line_count + 1 && wp->w_empty_rows == 0) {
// TODO(bfredl): The might be more cases to consider, like how does this
// interact with incomplete final line? Diff filler lines?
botline = wp->w_buffer->b_ml.ml_line_count;
ev_botline = 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,
botline, wp->w_cursor.lnum - 1, wp->w_cursor.col,
line_count, scroll_delta);
ui_call_win_viewport(wp->w_grid_alloc.handle, wp->handle, wp->w_topline - 1, ev_botline,
wp->w_cursor.lnum - 1, wp->w_cursor.col, line_count, delta);
wp->w_viewport_invalid = false;
wp->w_viewport_last_topline = wp->w_topline;
wp->w_viewport_last_botline = wp->w_botline;
wp->w_viewport_last_topfill = wp->w_topfill;
wp->w_viewport_last_skipcol = wp->w_skipcol;
}
}

View File

@@ -1904,7 +1904,7 @@ describe("folded lines", function()
meths.buf_set_extmark(0, ns, 2, 0, { virt_lines_above = true, virt_lines = {{{"virt_line above line 3", ""}}} })
meths.buf_set_extmark(0, ns, 3, 0, { virt_lines = {{{"virt_line below line 4", ""}}} })
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -1924,7 +1924,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 5, curline = 0, curcol = 0, linecount = 4, sum_scroll_delta = 0};
}}
else
screen:expect([[
{5:^+-- 2 lines: line 1·························}|
@@ -1940,7 +1942,7 @@ describe("folded lines", function()
feed('jzfj')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -1960,7 +1962,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 5, curline = 2, curcol = 0, linecount = 4, sum_scroll_delta = 0};
}}
else
screen:expect([[
{5:+-- 2 lines: line 1·························}|
@@ -1977,7 +1981,7 @@ describe("folded lines", function()
feed('kzo<C-Y>')
funcs.setline(5, 'line 5')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -1997,7 +2001,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = -1};
}}
else
screen:expect([[
virt_line above line 1 |
@@ -2025,7 +2031,7 @@ describe("folded lines", function()
meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} })
feed('G<C-E>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2045,7 +2051,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 0};
}}
else
screen:expect([[
line 1 |
@@ -2061,7 +2069,7 @@ describe("folded lines", function()
feed('<C-E>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2081,7 +2089,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 1, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 1};
}}
else
screen:expect([[
line 2 |
@@ -2097,7 +2107,7 @@ describe("folded lines", function()
feed('<C-E>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2117,7 +2127,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2};
}}
else
screen:expect([[
virt_line below line 2 |
@@ -2133,7 +2145,7 @@ describe("folded lines", function()
feed('<C-E>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2153,7 +2165,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 3};
}}
else
screen:expect([[
more virt_line below line 2 |
@@ -2169,7 +2183,7 @@ describe("folded lines", function()
feed('<C-E>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2189,7 +2203,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 4};
}}
else
screen:expect([[
{5:+-- 2 lines: line 3·························}|
@@ -2205,7 +2221,7 @@ describe("folded lines", function()
feed('<C-E>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2225,7 +2241,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 4, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 5};
}}
else
screen:expect([[
^line 5 |
@@ -2241,7 +2259,7 @@ describe("folded lines", function()
feed('3<C-Y>')
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2261,7 +2279,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2};
}}
else
screen:expect([[
virt_line below line 2 |
@@ -2277,7 +2297,7 @@ describe("folded lines", function()
meths.input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0)
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2297,7 +2317,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
{11:-- VISUAL LINE --} |
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2};
}}
else
screen:expect([[
virt_line below line 2 |
@@ -2313,7 +2335,7 @@ describe("folded lines", function()
meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0)
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2333,7 +2355,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
{11:-- VISUAL LINE --} |
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 3};
}}
else
screen:expect([[
more virt_line below line 2 |
@@ -2349,7 +2373,7 @@ describe("folded lines", function()
meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5)
if multigrid then
screen:expect([[
screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -2369,7 +2393,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
{11:-- VISUAL LINE --} |
]])
]], win_viewport={
[2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 5, linecount = 5, sum_scroll_delta = 4};
}}
else
screen:expect([[
{5:+-- 2 lines: line 3·························}|

View File

@@ -3343,6 +3343,220 @@ describe('ext_multigrid', function()
}}
end)
it('scroll_delta is approximated reasonably when scrolling many lines #24234', function()
command('setlocal number nowrap')
command('edit test/functional/fixtures/bigfile.txt')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:test/functional/fixtures/bigfile.txt }|
[3:-----------------------------------------------------]|
## grid 2
{19: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;; |
{19: 2 }0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;|
{19: 3 }0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
{19: 4 }0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
{19: 5 }0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSIO|
{19: 6 }0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
{19: 7 }0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
{19: 8 }0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
{19: 9 }0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;; |
{19: 10 }0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATIO|
{19: 11 }000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;; |
{19: 12 }000B;<control>;Cc;0;S;;;;;N;LINE TABULATION;;;;|
## grid 3
|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 13, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
}}
feed('G')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:test/functional/fixtures/bigfile.txt }|
[3:-----------------------------------------------------]|
## grid 2
{19:30581 }E01E8;VARIATION SELECTOR-249;Mn;0;NSM;;;;;N;;;;|
{19:30582 }E01E9;VARIATION SELECTOR-250;Mn;0;NSM;;;;;N;;;;|
{19:30583 }E01EA;VARIATION SELECTOR-251;Mn;0;NSM;;;;;N;;;;|
{19:30584 }E01EB;VARIATION SELECTOR-252;Mn;0;NSM;;;;;N;;;;|
{19:30585 }E01EC;VARIATION SELECTOR-253;Mn;0;NSM;;;;;N;;;;|
{19:30586 }E01ED;VARIATION SELECTOR-254;Mn;0;NSM;;;;;N;;;;|
{19:30587 }E01EE;VARIATION SELECTOR-255;Mn;0;NSM;;;;;N;;;;|
{19:30588 }E01EF;VARIATION SELECTOR-256;Mn;0;NSM;;;;;N;;;;|
{19:30589 }F0000;<Plane 15 Private Use, First>;Co;0;L;;;;;|
{19:30590 }FFFFD;<Plane 15 Private Use, Last>;Co;0;L;;;;;N|
{19:30591 }100000;<Plane 16 Private Use, First>;Co;0;L;;;;|
{19:30592 }^10FFFD;<Plane 16 Private Use, Last>;Co;0;L;;;;;|
## grid 3
|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 30580, botline = 30592, curline = 30591, curcol = 0, linecount = 30592, sum_scroll_delta = 30580};
}}
feed('gg')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:test/functional/fixtures/bigfile.txt }|
[3:-----------------------------------------------------]|
## grid 2
{19: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;; |
{19: 2 }0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;|
{19: 3 }0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
{19: 4 }0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
{19: 5 }0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSIO|
{19: 6 }0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
{19: 7 }0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
{19: 8 }0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
{19: 9 }0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;; |
{19: 10 }0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULATIO|
{19: 11 }000A;<control>;Cc;0;B;;;;;N;LINE FEED (LF);;;; |
{19: 12 }000B;<control>;Cc;0;S;;;;;N;LINE TABULATION;;;;|
## grid 3
|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 13, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
}}
command('setlocal wrap')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:test/functional/fixtures/bigfile.txt }|
[3:-----------------------------------------------------]|
## grid 2
{19: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;; |
{19: 2 }0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;|
{19: };; |
{19: 3 }0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
{19: 4 }0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
{19: 5 }0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSIO|
{19: }N;;;; |
{19: 6 }0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
{19: 7 }0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
{19: 8 }0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
{19: 9 }0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;; |
{19: 10 }0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULA{1:@@@}|
## grid 3
|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 10, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
}}
feed('G')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:test/functional/fixtures/bigfile.txt }|
[3:-----------------------------------------------------]|
## grid 2
{19:30587 }E01EE;VARIATION SELECTOR-255;Mn;0;NSM;;;;;N;;;;|
{19: }; |
{19:30588 }E01EF;VARIATION SELECTOR-256;Mn;0;NSM;;;;;N;;;;|
{19: }; |
{19:30589 }F0000;<Plane 15 Private Use, First>;Co;0;L;;;;;|
{19: }N;;;;; |
{19:30590 }FFFFD;<Plane 15 Private Use, Last>;Co;0;L;;;;;N|
{19: };;;;; |
{19:30591 }100000;<Plane 16 Private Use, First>;Co;0;L;;;;|
{19: };N;;;;; |
{19:30592 }^10FFFD;<Plane 16 Private Use, Last>;Co;0;L;;;;;|
{19: }N;;;;; |
## grid 3
|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 30586, botline = 30592, curline = 30591, curcol = 0, linecount = 30592, sum_scroll_delta = 30588};
}}
feed('gg')
screen:expect{grid=[[
## grid 1
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
[2:-----------------------------------------------------]|
{11:test/functional/fixtures/bigfile.txt }|
[3:-----------------------------------------------------]|
## grid 2
{19: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;; |
{19: 2 }0001;<control>;Cc;0;BN;;;;;N;START OF HEADING;;|
{19: };; |
{19: 3 }0002;<control>;Cc;0;BN;;;;;N;START OF TEXT;;;; |
{19: 4 }0003;<control>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
{19: 5 }0004;<control>;Cc;0;BN;;;;;N;END OF TRANSMISSIO|
{19: }N;;;; |
{19: 6 }0005;<control>;Cc;0;BN;;;;;N;ENQUIRY;;;; |
{19: 7 }0006;<control>;Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; |
{19: 8 }0007;<control>;Cc;0;BN;;;;;N;BELL;;;; |
{19: 9 }0008;<control>;Cc;0;BN;;;;;N;BACKSPACE;;;; |
{19: 10 }0009;<control>;Cc;0;S;;;;;N;CHARACTER TABULA{1:@@@}|
## grid 3
|
]], win_viewport={
[2] = {win = {id = 1000}, topline = 0, botline = 10, curline = 0, curcol = 0, linecount = 30592, sum_scroll_delta = 0};
}}
end)
it('does not crash when dragging mouse across grid boundary', function()
screen:try_resize(48, 8)
screen:expect{grid=[[