mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(ui-ext): "scroll_delta" handle topfill and skipcol (#24249)
This commit is contained in:
parent
92760a7f42
commit
e8b3ed74bc
@ -1226,6 +1226,8 @@ 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_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().
|
||||
|
@ -595,3 +595,52 @@ static int win_nolbr_chartabsize(chartabsize_T *cts, int *headp)
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int64_t win_get_text_height(win_T *const wp, const linenr_T first, const linenr_T last,
|
||||
const int64_t start_vcol, const int64_t end_vcol)
|
||||
{
|
||||
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 size = 0;
|
||||
int64_t height_nofill = 0;
|
||||
linenr_T lnum = first;
|
||||
|
||||
if (start_vcol >= 0) {
|
||||
linenr_T lnum_next = lnum;
|
||||
const bool folded = hasFoldingWin(wp, lnum, &lnum, &lnum_next, true, NULL);
|
||||
height_nofill = folded ? 1 : plines_win_nofill(wp, lnum, false);
|
||||
size += height_nofill;
|
||||
const int64_t row_off = (start_vcol < width1 || width2 <= 0)
|
||||
? 0
|
||||
: 1 + (start_vcol - width1) / width2;
|
||||
size -= MIN(row_off, height_nofill);
|
||||
lnum = lnum_next + 1;
|
||||
}
|
||||
|
||||
while (lnum <= last) {
|
||||
linenr_T lnum_next = lnum;
|
||||
const bool folded = hasFoldingWin(wp, lnum, &lnum, &lnum_next, true, NULL);
|
||||
height_nofill = folded ? 1 : plines_win_nofill(wp, lnum, false);
|
||||
size += win_get_fill(wp, lnum) + height_nofill;
|
||||
lnum = lnum_next + 1;
|
||||
}
|
||||
|
||||
if (end_vcol >= 0) {
|
||||
size -= height_nofill;
|
||||
const int64_t row_off = end_vcol == 0
|
||||
? 0
|
||||
: (end_vcol <= width1 || width2 <= 0)
|
||||
? 1
|
||||
: 1 + (end_vcol - width1 + width2 - 1) / width2;
|
||||
size += MIN(row_off, height_nofill);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -1037,22 +1037,31 @@ void ui_ext_win_viewport(win_T *wp)
|
||||
// interact with incomplete final line? Diff filler lines?
|
||||
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;
|
||||
int64_t delta = 0;
|
||||
linenr_T last_topline = wp->w_viewport_last_topline;
|
||||
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;
|
||||
}
|
||||
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);
|
||||
if (wp->w_topline < last_topline
|
||||
|| (wp->w_topline == last_topline && wp->w_skipcol < last_skipcol)) {
|
||||
delta -= win_get_text_height(wp, wp->w_topline, last_topline, wp->w_skipcol, last_skipcol);
|
||||
} else if ((wp->w_topline > last_topline && wp->w_topline <= line_count)
|
||||
|| (wp->w_topline == last_topline && wp->w_skipcol > last_skipcol)) {
|
||||
delta += win_get_text_height(wp, last_topline, wp->w_topline, last_skipcol, wp->w_skipcol);
|
||||
}
|
||||
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);
|
||||
delta += last_topfill;
|
||||
delta -= wp->w_topfill;
|
||||
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, delta);
|
||||
wp->w_viewport_invalid = false;
|
||||
wp->w_viewport_last_topline = wp->w_topline;
|
||||
wp->w_viewport_last_topfill = wp->w_topfill;
|
||||
wp->w_viewport_last_skipcol = wp->w_skipcol;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1923,7 +1923,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:---------------------------------------------]|
|
||||
@ -1943,7 +1943,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·························}|
|
||||
@ -1959,7 +1961,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('jzfj')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -1979,7 +1981,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·························}|
|
||||
@ -1996,7 +2000,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:---------------------------------------------]|
|
||||
@ -2016,7 +2020,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 |
|
||||
@ -2044,7 +2050,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:---------------------------------------------]|
|
||||
@ -2064,7 +2070,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 |
|
||||
@ -2080,7 +2088,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('<C-E>')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -2100,7 +2108,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 |
|
||||
@ -2116,7 +2126,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('<C-E>')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -2136,7 +2146,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 |
|
||||
@ -2152,7 +2164,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('<C-E>')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -2172,7 +2184,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 |
|
||||
@ -2188,7 +2202,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('<C-E>')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -2208,7 +2222,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·························}|
|
||||
@ -2224,7 +2240,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('<C-E>')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -2244,7 +2260,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 |
|
||||
@ -2260,7 +2278,7 @@ describe("folded lines", function()
|
||||
|
||||
feed('3<C-Y>')
|
||||
if multigrid then
|
||||
screen:expect([[
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[2:---------------------------------------------]|
|
||||
[2:---------------------------------------------]|
|
||||
@ -2280,7 +2298,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 |
|
||||
@ -2296,7 +2316,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:---------------------------------------------]|
|
||||
@ -2316,7 +2336,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 |
|
||||
@ -2332,7 +2354,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:---------------------------------------------]|
|
||||
@ -2352,7 +2374,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 |
|
||||
@ -2368,7 +2392,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:---------------------------------------------]|
|
||||
@ -2388,7 +2412,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·························}|
|
||||
|
@ -3341,6 +3341,294 @@ describe('ext_multigrid', function()
|
||||
[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},
|
||||
}}
|
||||
|
||||
command('close | 21vsplit | setlocal number smoothscroll')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{19: 1 }Lorem ipsu^m dolor|
|
||||
{19: } sit amet, consec|
|
||||
{19: }tetur |
|
||||
{19: 2 }adipisicing elit,|
|
||||
{19: } sed do eiusmod t|
|
||||
{19: }empor |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
}}
|
||||
|
||||
feed('5<C-E>')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{1:<<<}{19: }empo^r |
|
||||
{19: 3 }incididunt ut lab|
|
||||
{19: }ore et dolore mag|
|
||||
{19: }na aliqua. |
|
||||
{19: 4 }Ut enim ad minim |
|
||||
{19: }veniam, quis n{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 5};
|
||||
}}
|
||||
|
||||
feed('<C-Y>')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{1:<<<}{19: } sed do eiusmod t|
|
||||
{19: }empo^r |
|
||||
{19: 3 }incididunt ut lab|
|
||||
{19: }ore et dolore mag|
|
||||
{19: }na aliqua. |
|
||||
{19: 4 }Ut enim ad min{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 4};
|
||||
}}
|
||||
|
||||
command('set cpoptions+=n')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{1:<<<}d do eiusmod tempo|
|
||||
^r |
|
||||
{19: 3 }incididunt ut lab|
|
||||
ore et dolore magna a|
|
||||
liqua. |
|
||||
{19: 4 }Ut enim ad min{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 1, botline = 4, curline = 1, curcol = 38, linecount = 11, sum_scroll_delta = 4};
|
||||
}}
|
||||
|
||||
feed('4<C-E>')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{1:<<<}ua^. |
|
||||
{19: 4 }Ut enim ad minim |
|
||||
veniam, quis nostrud |
|
||||
{19: 5 }exercitation ulla|
|
||||
mco laboris nisi ut a|
|
||||
liquip ex |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 6, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 8};
|
||||
}}
|
||||
|
||||
feed('2<C-Y>')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{19: 3 }incididunt ut lab|
|
||||
ore et dolore magna a|
|
||||
liqua^. |
|
||||
{19: 4 }Ut enim ad minim |
|
||||
veniam, quis nostrud |
|
||||
{19: 5 }exercitation u{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 6};
|
||||
}}
|
||||
|
||||
command('setlocal numberwidth=12')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{19: 3 }incididun|
|
||||
t ut labore et dolore|
|
||||
magna aliqua^. |
|
||||
{19: 4 }Ut enim a|
|
||||
d minim veniam, quis |
|
||||
nostrud |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 6};
|
||||
}}
|
||||
|
||||
feed('2<C-E>')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{1:<<<}gna aliqua^. |
|
||||
{19: 4 }Ut enim a|
|
||||
d minim veniam, quis |
|
||||
nostrud |
|
||||
{19: 5 }exercitat|
|
||||
ion ullamco labori{1:@@@}|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 2, botline = 5, curline = 2, curcol = 43, linecount = 11, sum_scroll_delta = 8};
|
||||
}}
|
||||
|
||||
feed('<C-E>')
|
||||
screen:expect{grid=[[
|
||||
## grid 1
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
[5:---------------------]│[2:--------------------------]|
|
||||
{11:[No Name] [+] }{12:[No Name] [+] }|
|
||||
[3:------------------------------------------------]|
|
||||
## grid 2
|
||||
Lorem ipsum dolor sit amet|
|
||||
, consectetur |
|
||||
adipisicing elit, sed do e|
|
||||
iusmod tempor |
|
||||
incididunt ut labore et do|
|
||||
lore magna aliqua. |
|
||||
## grid 3
|
||||
|
|
||||
## grid 5
|
||||
{19: 4 }Ut enim a|
|
||||
d minim veniam, quis |
|
||||
nostru^d |
|
||||
{19: 5 }exercitat|
|
||||
ion ullamco laboris n|
|
||||
isi ut aliquip ex |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 4, curline = 0, curcol = 10, linecount = 11, sum_scroll_delta = 0};
|
||||
[5] = {win = {id = 1002}, topline = 3, botline = 6, curline = 3, curcol = 36, linecount = 11, sum_scroll_delta = 9};
|
||||
}}
|
||||
end)
|
||||
|
||||
it('does not crash when dragging mouse across grid boundary', function()
|
||||
|
Loading…
Reference in New Issue
Block a user