mirror of https://github.com/neovim/neovim.git
refactor: add win_T argument to setcursor_mayforce()
This commit is contained in:
parent
d5063f4b29
commit
7b14eb543d
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue