From 9f28eddfab368697c21e6628fdf55af5ec4f4c39 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sun, 19 Jun 2022 16:08:43 +0300 Subject: fix(float): make `screen*()` functions respect floating windows Resolves #19013. --- src/nvim/eval.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/nvim/eval.c') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a4f56b47e6..43d6ed558f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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". -- cgit