fix(float): make screen*() functions respect floating windows

Resolves #19013.
This commit is contained in:
Evgeni Chasnovski
2022-06-19 16:08:43 +03:00
parent 7b2b44bce4
commit 9f28eddfab
4 changed files with 112 additions and 23 deletions

View File

@@ -49,6 +49,7 @@
#include "nvim/sign.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/undo.h"
#include "nvim/version.h"
#include "nvim/window.h"
@@ -6849,19 +6850,19 @@ void return_register(int regname, typval_T *rettv)
rettv->vval.v_string = xstrdup(buf);
}
void screenchar_adjust_grid(ScreenGrid **grid, int *row, int *col)
void screenchar_adjust(ScreenGrid **grid, int *row, int *col)
{
// TODO(bfredl): this is a hack for legacy tests which use screenchar()
// to check printed messages on the screen (but not floats etc
// as these are not legacy features). If the compositor is refactored to
// have its own buffer, this should just read from it instead.
msg_scroll_flush();
if (msg_grid.chars && msg_grid.comp_index > 0 && *row >= msg_grid.comp_row
&& *row < (msg_grid.rows + msg_grid.comp_row)
&& *col < msg_grid.cols) {
*grid = &msg_grid;
*row -= msg_grid.comp_row;
}
*grid = ui_comp_get_grid_at_coord(*row, *col);
// Make `row` and `col` relative to the grid
*row -= (*grid)->comp_row;
*col -= (*grid)->comp_col;
}
/// Set line or list of lines in buffer "buf".