Skip to content

Commit

Permalink
patch 8.0.1138: click in window toolbar starts Visual mode
Browse files Browse the repository at this point in the history
Problem:    Click in window toolbar starts Visual mode.
Solution:   Add the MOUSE_WINBAR flag.
  • Loading branch information
brammool committed Sep 23, 2017
1 parent e745d75 commit eb163d7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/normal.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2794,6 +2794,12 @@ do_mouse(
*/ */
jump_flags = jump_to_mouse(jump_flags, jump_flags = jump_to_mouse(jump_flags,
oap == NULL ? NULL : &(oap->inclusive), which_button); oap == NULL ? NULL : &(oap->inclusive), which_button);

#ifdef FEAT_MENU
/* A click in the window toolbar has no side effects. */
if (jump_flags & MOUSE_WINBAR)
return FALSE;
#endif
moved = (jump_flags & CURSOR_MOVED); moved = (jump_flags & CURSOR_MOVED);
in_status_line = (jump_flags & IN_STATUS_LINE); in_status_line = (jump_flags & IN_STATUS_LINE);
in_sep_line = (jump_flags & IN_SEP_LINE); in_sep_line = (jump_flags & IN_SEP_LINE);
Expand Down
14 changes: 13 additions & 1 deletion src/ui.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2611,6 +2611,9 @@ jump_to_mouse(
{ {
static int on_status_line = 0; /* #lines below bottom of window */ static int on_status_line = 0; /* #lines below bottom of window */
static int on_sep_line = 0; /* on separator right of window */ static int on_sep_line = 0; /* on separator right of window */
#ifdef FEAT_MENU
static int in_winbar = FALSE;
#endif
static int prev_row = -1; static int prev_row = -1;
static int prev_col = -1; static int prev_col = -1;
static win_T *dragwin = NULL; /* window being dragged */ static win_T *dragwin = NULL; /* window being dragged */
Expand Down Expand Up @@ -2699,8 +2702,10 @@ jump_to_mouse(
/* A click in the window toolbar does not enter another window or /* A click in the window toolbar does not enter another window or
* change Visual highlighting. */ * change Visual highlighting. */
winbar_click(wp, col); winbar_click(wp, col);
return IN_OTHER_WIN; in_winbar = TRUE;
return IN_OTHER_WIN | MOUSE_WINBAR;
} }
in_winbar = FALSE;
#endif #endif


/* /*
Expand Down Expand Up @@ -2829,6 +2834,13 @@ jump_to_mouse(
} }
return IN_SEP_LINE; /* Cursor didn't move */ return IN_SEP_LINE; /* Cursor didn't move */
} }
#ifdef FEAT_MENU
else if (in_winbar)
{
/* After a click on the window toolbar don't start Visual mode. */
return IN_OTHER_WIN | MOUSE_WINBAR;
}
#endif
else /* keep_window_focus must be TRUE */ else /* keep_window_focus must be TRUE */
{ {
/* before moving the cursor for a left click, stop Visual mode */ /* before moving the cursor for a left click, stop Visual mode */
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =


static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1138,
/**/ /**/
1137, 1137,
/**/ /**/
Expand Down
1 change: 1 addition & 0 deletions src/vim.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ typedef int sock_T;
# define CURSOR_MOVED 0x100 # define CURSOR_MOVED 0x100
# define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */ # define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */
# define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */ # define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */
# define MOUSE_WINBAR 0x800 /* in window toolbar */


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

0 comments on commit eb163d7

Please sign in to comment.