diff options
author | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2022-06-19 16:08:43 +0300 |
---|---|---|
committer | Evgeni Chasnovski <evgeni.chasnovski@gmail.com> | 2022-06-23 10:34:02 +0300 |
commit | 9f28eddfab368697c21e6628fdf55af5ec4f4c39 (patch) | |
tree | ba305b2d2786160d882d14bcaef22d0ea727a02a /src/nvim/eval.c | |
parent | 7b2b44bce4bff85d9fd1bef09d294ddb889056e4 (diff) | |
download | rneovim-9f28eddfab368697c21e6628fdf55af5ec4f4c39.tar.gz rneovim-9f28eddfab368697c21e6628fdf55af5ec4f4c39.tar.bz2 rneovim-9f28eddfab368697c21e6628fdf55af5ec4f4c39.zip |
fix(float): make `screen*()` functions respect floating windows
Resolves #19013.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 15 |
1 files changed, 8 insertions, 7 deletions
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". |