Skip to content

Commit eb163d7

Browse files
committed
patch 8.0.1138: click in window toolbar starts Visual mode
Problem: Click in window toolbar starts Visual mode. Solution: Add the MOUSE_WINBAR flag.
1 parent e745d75 commit eb163d7

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

src/normal.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,6 +2794,12 @@ do_mouse(
27942794
*/
27952795
jump_flags = jump_to_mouse(jump_flags,
27962796
oap == NULL ? NULL : &(oap->inclusive), which_button);
2797+
2798+
#ifdef FEAT_MENU
2799+
/* A click in the window toolbar has no side effects. */
2800+
if (jump_flags & MOUSE_WINBAR)
2801+
return FALSE;
2802+
#endif
27972803
moved = (jump_flags & CURSOR_MOVED);
27982804
in_status_line = (jump_flags & IN_STATUS_LINE);
27992805
in_sep_line = (jump_flags & IN_SEP_LINE);

src/ui.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,6 +2611,9 @@ jump_to_mouse(
26112611
{
26122612
static int on_status_line = 0; /* #lines below bottom of window */
26132613
static int on_sep_line = 0; /* on separator right of window */
2614+
#ifdef FEAT_MENU
2615+
static int in_winbar = FALSE;
2616+
#endif
26142617
static int prev_row = -1;
26152618
static int prev_col = -1;
26162619
static win_T *dragwin = NULL; /* window being dragged */
@@ -2699,8 +2702,10 @@ jump_to_mouse(
26992702
/* A click in the window toolbar does not enter another window or
27002703
* change Visual highlighting. */
27012704
winbar_click(wp, col);
2702-
return IN_OTHER_WIN;
2705+
in_winbar = TRUE;
2706+
return IN_OTHER_WIN | MOUSE_WINBAR;
27032707
}
2708+
in_winbar = FALSE;
27042709
#endif
27052710

27062711
/*
@@ -2829,6 +2834,13 @@ jump_to_mouse(
28292834
}
28302835
return IN_SEP_LINE; /* Cursor didn't move */
28312836
}
2837+
#ifdef FEAT_MENU
2838+
else if (in_winbar)
2839+
{
2840+
/* After a click on the window toolbar don't start Visual mode. */
2841+
return IN_OTHER_WIN | MOUSE_WINBAR;
2842+
}
2843+
#endif
28322844
else /* keep_window_focus must be TRUE */
28332845
{
28342846
/* before moving the cursor for a left click, stop Visual mode */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1138,
764766
/**/
765767
1137,
766768
/**/

src/vim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,7 @@ typedef int sock_T;
18981898
# define CURSOR_MOVED 0x100
18991899
# define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */
19001900
# define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */
1901+
# define MOUSE_WINBAR 0x800 /* in window toolbar */
19011902

19021903
/* flags for jump_to_mouse() */
19031904
# define MOUSE_FOCUS 0x01 /* need to stay in this window */

0 commit comments

Comments
 (0)