summaryrefslogtreecommitdiffstats
path: root/src/mouse.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2023-08-16 14:17:36 +0100
committerChristian Brabandt <cb@256bit.org>2024-01-23 22:31:55 +0100
commit988f74311c26ea9917e84fbae608de226dba7e5f (patch)
tree95c475b5966ba8fac1f241e604d437bfed19c693 /src/mouse.c
parent4927110a434e75f8f22188a95b366cfd1fa17e07 (diff)
patch 9.1.0047: issues with temp curwin/buf while cmdwin is openv9.1.0047
Problem: Things that temporarily change/restore curwin/buf (e.g: win_execute, some autocmds) may break assumptions that curwin/buf is the cmdwin when "cmdwin_type != 0", causing issues. Solution: Expose the cmdwin's real win/buf and check that instead. Also try to ensure these variables are NULL if "cmdwin_type == 0", allowing them to be used directly in most cases without checking cmdwin_type. (Sean Dewar) Alternatively, we could ban win_execute in the cmdwin and audit all places that temporarily change/restore curwin/buf, but I didn't notice any problems arising from allowing this (standard cmdwin restrictions still apply, so things that may actually break the cmdwin are still forbidden). closes: #12819 Signed-off-by: Sean Dewar <seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/mouse.c')
-rw-r--r--src/mouse.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mouse.c b/src/mouse.c
index b283c6479a..b0db60f11f 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -1696,7 +1696,7 @@ retnomove:
}
#if defined(FEAT_CLIPBOARD)
// Continue a modeless selection in another window.
- if (cmdwin_type != 0 && row < curwin->w_winrow)
+ if (cmdwin_type != 0 && row < cmdwin_win->w_winrow)
return IN_OTHER_WIN;
#endif
#ifdef FEAT_PROP_POPUP
@@ -1824,7 +1824,7 @@ retnomove:
# ifdef FEAT_RIGHTLEFT
wp->w_p_rl ? col < wp->w_width - wp->w_p_fdc :
# endif
- col >= wp->w_p_fdc + (cmdwin_type == 0 && wp == curwin ? 0 : 1)
+ col >= wp->w_p_fdc + (wp != cmdwin_win ? 0 : 1)
)
#endif
&& (flags & MOUSE_MAY_STOP_VIS))))
@@ -1832,7 +1832,7 @@ retnomove:
end_visual_mode_keep_button();
redraw_curbuf_later(UPD_INVERTED); // delete the inversion
}
- if (cmdwin_type != 0 && wp != curwin)
+ if (cmdwin_type != 0 && wp != cmdwin_win)
{
// A click outside the command-line window: Use modeless
// selection if possible. Allow dragging the status lines.
@@ -1844,7 +1844,7 @@ retnomove:
#else
row = 0;
col += wp->w_wincol;
- wp = curwin;
+ wp = cmdwin_win;
#endif
}
#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
@@ -1937,7 +1937,7 @@ retnomove:
#if defined(FEAT_CLIPBOARD)
// Continue a modeless selection in another window.
- if (cmdwin_type != 0 && row < curwin->w_winrow)
+ if (cmdwin_type != 0 && row < cmdwin_win->w_winrow)
return IN_OTHER_WIN;
#endif
#ifdef FEAT_PROP_POPUP
@@ -2075,7 +2075,7 @@ retnomove:
# ifdef FEAT_RIGHTLEFT
curwin->w_p_rl ? col < curwin->w_width - curwin->w_p_fdc :
# endif
- col >= curwin->w_p_fdc + (cmdwin_type == 0 ? 0 : 1)
+ col >= curwin->w_p_fdc + (cmdwin_win != curwin ? 0 : 1)
)
mouse_char = ' ';
#endif