summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-23 15:08:17 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-23 15:08:17 +0200
commiteb163d73b11c10b461a2839530173a33d7915a33 (patch)
tree581dae7631cb4d5e1f4d1aea5a071f39034a018d
parente745d75c3e0d976e73bd17c395e9cce98f671692 (diff)
downloadvim-git-8.0.1138.tar.gz
patch 8.0.1138: click in window toolbar starts Visual modev8.0.1138
Problem: Click in window toolbar starts Visual mode. Solution: Add the MOUSE_WINBAR flag.
-rw-r--r--src/normal.c6
-rw-r--r--src/ui.c14
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h1
4 files changed, 22 insertions, 1 deletions
diff --git a/src/normal.c b/src/normal.c
index d2d1a2921..d78a53bae 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2794,6 +2794,12 @@ do_mouse(
*/
jump_flags = jump_to_mouse(jump_flags,
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);
in_status_line = (jump_flags & IN_STATUS_LINE);
in_sep_line = (jump_flags & IN_SEP_LINE);
diff --git a/src/ui.c b/src/ui.c
index 867b8a501..f175e1abf 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -2611,6 +2611,9 @@ jump_to_mouse(
{
static int on_status_line = 0; /* #lines below bottom 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_col = -1;
static win_T *dragwin = NULL; /* window being dragged */
@@ -2699,8 +2702,10 @@ retnomove:
/* A click in the window toolbar does not enter another window or
* change Visual highlighting. */
winbar_click(wp, col);
- return IN_OTHER_WIN;
+ in_winbar = TRUE;
+ return IN_OTHER_WIN | MOUSE_WINBAR;
}
+ in_winbar = FALSE;
#endif
/*
@@ -2829,6 +2834,13 @@ retnomove:
}
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 */
{
/* before moving the cursor for a left click, stop Visual mode */
diff --git a/src/version.c b/src/version.c
index abb9300d7..a2f71a3d9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1138,
+/**/
1137,
/**/
1136,
diff --git a/src/vim.h b/src/vim.h
index 1c91b7dd6..43dbd8c4a 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1898,6 +1898,7 @@ typedef int sock_T;
# define CURSOR_MOVED 0x100
# define MOUSE_FOLD_CLOSE 0x200 /* 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() */
# define MOUSE_FOCUS 0x01 /* need to stay in this window */