aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-06-23 12:01:27 +0200
committerGitHub <noreply@github.com>2022-06-23 12:01:27 +0200
commita3ce03bef1d54d67ad5dff4b35691e7f9b31cafa (patch)
tree47e1498a2523e88f0184a6e7958d24cca3a13d93 /src/nvim/eval.c
parente694e564220acc58b1cb4132ad3c8a0fa02067d9 (diff)
parent9f28eddfab368697c21e6628fdf55af5ec4f4c39 (diff)
downloadrneovim-a3ce03bef1d54d67ad5dff4b35691e7f9b31cafa.tar.gz
rneovim-a3ce03bef1d54d67ad5dff4b35691e7f9b31cafa.tar.bz2
rneovim-a3ce03bef1d54d67ad5dff4b35691e7f9b31cafa.zip
Merge pull request #19020 from echasnovski/screenchar-float
fix(float): make `screen*()` functions respect floating windows
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c15
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".