feat(api): win_viewport also sends line_count #15613

This commit is contained in:
Yatao Li
2021-09-11 10:19:39 +08:00
committed by GitHub
parent 09a477737f
commit 086631cd92
5 changed files with 65 additions and 59 deletions

View File

@@ -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,

View File

@@ -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;
}
}