To: vim_dev@googlegroups.com Subject: Patch 8.0.1138 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1138 Problem: Click in window toolbar starts Visual mode. Solution: Add the MOUSE_WINBAR flag. Files: src/ui.c, src/vim.h, src/normal.c *** ../vim-8.0.1137/src/ui.c 2017-09-22 15:20:27.744148592 +0200 --- src/ui.c 2017-09-22 23:49:11.140065456 +0200 *************** *** 2611,2616 **** --- 2611,2619 ---- { 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,2706 **** /* A click in the window toolbar does not enter another window or * change Visual highlighting. */ winbar_click(wp, col); ! return IN_OTHER_WIN; } #endif /* --- 2702,2711 ---- /* A click in the window toolbar does not enter another window or * change Visual highlighting. */ winbar_click(wp, col); ! in_winbar = TRUE; ! return IN_OTHER_WIN | MOUSE_WINBAR; } + in_winbar = FALSE; #endif /* *************** *** 2829,2834 **** --- 2834,2846 ---- } 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 */ *** ../vim-8.0.1137/src/vim.h 2017-09-22 15:20:27.748148568 +0200 --- src/vim.h 2017-09-22 21:42:57.513542605 +0200 *************** *** 1898,1903 **** --- 1898,1904 ---- # 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 */ *** ../vim-8.0.1137/src/normal.c 2017-09-22 15:20:27.740148617 +0200 --- src/normal.c 2017-09-22 22:01:24.842933314 +0200 *************** *** 2794,2799 **** --- 2794,2805 ---- */ 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); *** ../vim-8.0.1137/src/version.c 2017-09-22 16:56:15.964914273 +0200 --- src/version.c 2017-09-23 15:07:25.876805339 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1138, /**/ -- hundred-and-one symptoms of being an internet addict: 178. You look for an icon to double-click to open your bedroom window. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///