mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
feat(api): win_viewport also sends line_count #15613
This commit is contained in:
parent
09a477737f
commit
086631cd92
@ -119,7 +119,8 @@ void msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep_char)
|
||||
FUNC_API_SINCE(6) FUNC_API_BRIDGE_IMPL FUNC_API_COMPOSITOR_IMPL;
|
||||
|
||||
void win_viewport(Integer grid, Window win, Integer topline,
|
||||
Integer botline, Integer curline, Integer curcol)
|
||||
Integer botline, Integer curline, Integer curcol,
|
||||
Integer line_count)
|
||||
FUNC_API_SINCE(7) FUNC_API_REMOTE_ONLY;
|
||||
|
||||
void popupmenu_show(Array items, Integer selected,
|
||||
|
@ -840,14 +840,15 @@ void ui_ext_win_viewport(win_T *wp)
|
||||
{
|
||||
if ((wp == curwin || ui_has(kUIMultigrid)) && wp->w_viewport_invalid) {
|
||||
int botline = wp->w_botline;
|
||||
if (botline == wp->w_buffer->b_ml.ml_line_count+1
|
||||
&& wp->w_empty_rows == 0) {
|
||||
int line_count = wp->w_buffer->b_ml.ml_line_count;
|
||||
if (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;
|
||||
}
|
||||
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);
|
||||
wp->w_viewport_invalid = false;
|
||||
}
|
||||
}
|
||||
|
@ -782,8 +782,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -825,8 +825,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -868,8 +868,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -911,8 +911,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -955,8 +955,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -996,8 +996,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -1037,8 +1037,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -1087,8 +1087,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 2, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 5, curcol = 0, linecount = 6};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 2};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -1138,8 +1138,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[4] = { { id = 1001 }, "NW", 1, 0, 0, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -1196,8 +1196,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[5] = { { id = 1002 }, "NW", 1, 0, 5, true }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -1255,8 +1255,8 @@ describe('float window', function()
|
||||
[5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 },
|
||||
[6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -1705,6 +1705,7 @@ describe('float window', function()
|
||||
botline = 3,
|
||||
curline = 0,
|
||||
curcol = 3,
|
||||
linecount = 2,
|
||||
win = { id = 1000 }
|
||||
},
|
||||
[4] = {
|
||||
@ -1712,6 +1713,7 @@ describe('float window', function()
|
||||
botline = 3,
|
||||
curline = 0,
|
||||
curcol = 3,
|
||||
linecount = 2,
|
||||
win = { id = 1001 }
|
||||
},
|
||||
[5] = {
|
||||
@ -1719,6 +1721,7 @@ describe('float window', function()
|
||||
botline = 2,
|
||||
curline = 0,
|
||||
curcol = 0,
|
||||
linecount = 1,
|
||||
win = { id = 1002 }
|
||||
}
|
||||
}}
|
||||
@ -6339,8 +6342,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[4] = { { id = 1001 }, "NW", 1, 2, 5, true };
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -6396,10 +6399,10 @@ describe('float window', function()
|
||||
[5] = { { id = 1002 }, "NW", 1, 3, 8, true };
|
||||
[6] = { { id = 1003 }, "NW", 1, 4, 10, true };
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
|
||||
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -6444,8 +6447,8 @@ describe('float window', function()
|
||||
]], float_pos={
|
||||
[4] = { { id = 1001 }, "NW", 1, 2, 5, true };
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -6501,10 +6504,10 @@ describe('float window', function()
|
||||
[5] = { { id = 1002 }, "NW", 1, 4, 10, true };
|
||||
[6] = { { id = 1003 }, "NW", 1, 3, 8, true };
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
@ -6564,10 +6567,10 @@ describe('float window', function()
|
||||
[5] = {{id = 1002}, "NW", 1, 2, 6, true, 50};
|
||||
[6] = {{id = 1003}, "NW", 1, 3, 7, true, 40};
|
||||
}, win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0};
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
[6] = {win = {id = 1003}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
|
||||
}}
|
||||
else
|
||||
screen:expect{grid=[[
|
||||
|
@ -2117,7 +2117,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0}
|
||||
[2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}
|
||||
}}
|
||||
insert([[
|
||||
Lorem ipsum dolor sit amet, consectetur
|
||||
@ -2152,7 +2152,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7},
|
||||
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11},
|
||||
}}
|
||||
|
||||
|
||||
@ -2177,7 +2177,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0},
|
||||
[2] = {win = {id = 1000}, topline = 2, botline = 9, curline = 7, curcol = 0, linecount = 11},
|
||||
}}
|
||||
|
||||
command("split")
|
||||
@ -2201,8 +2201,8 @@ describe('ext_multigrid', function()
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
^dolore eu fugiat nulla pariatur. Excepteur sint |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
|
||||
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0},
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
|
||||
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 7, curcol = 0, linecount = 11},
|
||||
}}
|
||||
|
||||
feed("b")
|
||||
@ -2226,8 +2226,8 @@ describe('ext_multigrid', function()
|
||||
reprehenderit in voluptate velit esse ^cillum |
|
||||
dolore eu fugiat nulla pariatur. Excepteur sint |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
|
||||
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38},
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
|
||||
[4] = {win = {id = 1001}, topline = 5, botline = 9, curline = 6, curcol = 38, linecount = 11},
|
||||
}}
|
||||
|
||||
feed("2k")
|
||||
@ -2251,8 +2251,8 @@ describe('ext_multigrid', function()
|
||||
ea commodo consequat. Duis aute irure dolor in |
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 9, curline = 7, curcol = 0, linecount = 11},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11},
|
||||
}}
|
||||
|
||||
-- handles non-current window
|
||||
@ -2277,8 +2277,8 @@ describe('ext_multigrid', function()
|
||||
ea commodo consequat. Duis aute irure dolor in |
|
||||
reprehenderit in voluptate velit esse cillum |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38},
|
||||
[2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 10, linecount = 11},
|
||||
[4] = {win = {id = 1001}, topline = 4, botline = 8, curline = 4, curcol = 38, linecount = 11},
|
||||
}}
|
||||
end)
|
||||
|
||||
@ -2304,7 +2304,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0}
|
||||
[2] = {win = { id = 1000 }, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}
|
||||
}}
|
||||
insert([[
|
||||
Lorem ipsum dolor sit amet, consectetur
|
||||
@ -2339,7 +2339,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
|
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7},
|
||||
[2] = {win = {id = 1000}, topline = 5, botline = 11, curline = 10, curcol = 7, linecount = 11},
|
||||
}}
|
||||
|
||||
meths.input_mouse('left', 'press', '', 1,5, 1)
|
||||
@ -2366,7 +2366,7 @@ describe('ext_multigrid', function()
|
||||
## grid 3
|
||||
{7:-- VISUAL --} |
|
||||
]], win_viewport={
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1},
|
||||
[2] = {win = {id = 1000}, topline = 6, botline = 12, curline = 10, curcol = 1, linecount = 11},
|
||||
}}
|
||||
end)
|
||||
end)
|
||||
|
@ -773,13 +773,14 @@ function Screen:_handle_win_pos(grid, win, startrow, startcol, width, height)
|
||||
self.float_pos[grid] = nil
|
||||
end
|
||||
|
||||
function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol)
|
||||
function Screen:_handle_win_viewport(grid, win, topline, botline, curline, curcol, linecount)
|
||||
self.win_viewport[grid] = {
|
||||
win = win,
|
||||
topline = topline,
|
||||
botline = botline,
|
||||
curline = curline,
|
||||
curcol = curcol
|
||||
curcol = curcol,
|
||||
linecount = linecount
|
||||
}
|
||||
end
|
||||
|
||||
@ -1306,7 +1307,7 @@ local function fmt_ext_state(name, state)
|
||||
for k,v in pairs(state) do
|
||||
str = (str.." ["..k.."] = {win = {id = "..v.win.id.."}, topline = "
|
||||
..v.topline..", botline = "..v.botline..", curline = "..v.curline
|
||||
..", curcol = "..v.curcol.."};\n")
|
||||
..", curcol = "..v.curcol..", linecount = "..v.linecount.."};\n")
|
||||
end
|
||||
return str .. "}"
|
||||
elseif name == "float_pos" then
|
||||
|
Loading…
Reference in New Issue
Block a user