aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-04-10 11:41:48 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2024-05-02 15:46:15 +0200
commit7b14eb543d43344e2498335dc93a68d200469516 (patch)
tree13b1d65ca52c1884eb8f9208e0d74983c0dd055b /src
parentd5063f4b290e1c4262f7ced6d425ff2d7a2e2045 (diff)
downloadrneovim-7b14eb543d43344e2498335dc93a68d200469516.tar.gz
rneovim-7b14eb543d43344e2498335dc93a68d200469516.tar.bz2
rneovim-7b14eb543d43344e2498335dc93a68d200469516.zip
refactor: add win_T argument to setcursor_mayforce()
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawscreen.c20
-rw-r--r--src/nvim/ex_docmd.c2
-rw-r--r--src/nvim/popupmenu.c2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index 5e834e4b79..b709b49dba 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -821,25 +821,25 @@ static void win_redr_border(win_T *wp)
/// Set cursor to its position in the current window.
void setcursor(void)
{
- setcursor_mayforce(false);
+ setcursor_mayforce(curwin, false);
}
/// Set cursor to its position in the current window.
/// @param force when true, also when not redrawing.
-void setcursor_mayforce(bool force)
+void setcursor_mayforce(win_T *wp, bool force)
{
if (force || redrawing()) {
- validate_cursor(curwin);
+ validate_cursor(wp);
- ScreenGrid *grid = &curwin->w_grid;
- int row = curwin->w_wrow;
- int col = curwin->w_wcol;
- if (curwin->w_p_rl) {
+ ScreenGrid *grid = &wp->w_grid;
+ int row = wp->w_wrow;
+ int col = wp->w_wcol;
+ if (wp->w_p_rl) {
// With 'rightleft' set and the cursor on a double-wide character,
// position it on the leftmost column.
- col = curwin->w_width_inner - curwin->w_wcol
- - ((utf_ptr2cells(get_cursor_pos_ptr()) == 2
- && vim_isprintc(gchar_cursor())) ? 2 : 1);
+ char *cursor = ml_get_buf(wp->w_buffer, wp->w_cursor.lnum) + wp->w_cursor.col;
+ col = wp->w_width_inner - wp->w_wcol - ((utf_ptr2cells(cursor) == 2
+ && vim_isprintc(utf_ptr2char(cursor))) ? 2 : 1);
}
grid_adjust(&grid, &row, &col);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index e0a5e3e2bb..47b4c1e47d 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5886,7 +5886,7 @@ static void ex_equal(exarg_T *eap)
static void ex_sleep(exarg_T *eap)
{
if (cursor_valid(curwin)) {
- setcursor_mayforce(true);
+ setcursor_mayforce(curwin, true);
}
int64_t len = eap->line2;
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 0a8842a136..86f3611ec5 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -1281,7 +1281,7 @@ void pum_show_popupmenu(vimmenu_T *menu)
pum_is_drawn = true;
pum_grid.zindex = kZIndexCmdlinePopupMenu; // show above cmdline area #23275
pum_redraw();
- setcursor_mayforce(true);
+ setcursor_mayforce(curwin, true);
int c = vgetc();