To: vim_dev@googlegroups.com Subject: Patch 7.4.1894 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1894 Problem: Cannot get the window ID for a mouse click. Solution: Add v:mouse_winid. Files: src/eval.c, src/vim.h, runtime/doc/eval.txt *** ../vim-7.4.1893/src/eval.c 2016-06-04 17:58:48.482111677 +0200 --- src/eval.c 2016-06-04 18:02:51.050108340 +0200 *************** *** 359,364 **** --- 359,365 ---- {VV_NAME("swapcommand", VAR_STRING), VV_RO}, {VV_NAME("char", VAR_STRING), 0}, {VV_NAME("mouse_win", VAR_NUMBER), 0}, + {VV_NAME("mouse_winid", VAR_NUMBER), 0}, {VV_NAME("mouse_lnum", VAR_NUMBER), 0}, {VV_NAME("mouse_col", VAR_NUMBER), 0}, {VV_NAME("operator", VAR_STRING), VV_RO}, *************** *** 12755,12760 **** --- 12756,12762 ---- --allow_keys; vimvars[VV_MOUSE_WIN].vv_nr = 0; + vimvars[VV_MOUSE_WINID].vv_nr = 0; vimvars[VV_MOUSE_LNUM].vv_nr = 0; vimvars[VV_MOUSE_COL].vv_nr = 0; *************** *** 12810,12815 **** --- 12812,12818 ---- ++winnr; # endif vimvars[VV_MOUSE_WIN].vv_nr = winnr; + vimvars[VV_MOUSE_WINID].vv_nr = win->w_id; vimvars[VV_MOUSE_LNUM].vv_nr = lnum; vimvars[VV_MOUSE_COL].vv_nr = col + 1; } *** ../vim-7.4.1893/src/vim.h 2016-06-04 17:40:59.686126379 +0200 --- src/vim.h 2016-06-04 18:03:27.822107834 +0200 *************** *** 1887,1912 **** #define VV_SWAPCOMMAND 48 #define VV_CHAR 49 #define VV_MOUSE_WIN 50 ! #define VV_MOUSE_LNUM 51 ! #define VV_MOUSE_COL 52 ! #define VV_OP 53 ! #define VV_SEARCHFORWARD 54 ! #define VV_HLSEARCH 55 ! #define VV_OLDFILES 56 ! #define VV_WINDOWID 57 ! #define VV_PROGPATH 58 ! #define VV_COMPLETED_ITEM 59 ! #define VV_OPTION_NEW 60 ! #define VV_OPTION_OLD 61 ! #define VV_OPTION_TYPE 62 ! #define VV_ERRORS 63 ! #define VV_FALSE 64 ! #define VV_TRUE 65 ! #define VV_NULL 66 ! #define VV_NONE 67 ! #define VV_VIM_DID_ENTER 68 ! #define VV_TESTING 69 ! #define VV_LEN 70 /* number of v: vars */ /* used for v_number in VAR_SPECIAL */ #define VVAL_FALSE 0L --- 1887,1913 ---- #define VV_SWAPCOMMAND 48 #define VV_CHAR 49 #define VV_MOUSE_WIN 50 ! #define VV_MOUSE_WINID 51 ! #define VV_MOUSE_LNUM 52 ! #define VV_MOUSE_COL 53 ! #define VV_OP 54 ! #define VV_SEARCHFORWARD 55 ! #define VV_HLSEARCH 56 ! #define VV_OLDFILES 57 ! #define VV_WINDOWID 58 ! #define VV_PROGPATH 59 ! #define VV_COMPLETED_ITEM 60 ! #define VV_OPTION_NEW 61 ! #define VV_OPTION_OLD 62 ! #define VV_OPTION_TYPE 63 ! #define VV_ERRORS 64 ! #define VV_FALSE 65 ! #define VV_TRUE 66 ! #define VV_NULL 67 ! #define VV_NONE 68 ! #define VV_VIM_DID_ENTER 69 ! #define VV_TESTING 70 ! #define VV_LEN 71 /* number of v: vars */ /* used for v_number in VAR_SPECIAL */ #define VVAL_FALSE 0L *** ../vim-7.4.1893/runtime/doc/eval.txt 2016-06-04 17:58:48.486111677 +0200 --- runtime/doc/eval.txt 2016-06-04 18:01:10.726109720 +0200 *************** *** 1572,1577 **** --- 1595,1604 ---- First window has number 1, like with |winnr()|. The value is zero when there was no mouse button click. + *v:mouse_winid* *mouse_winid-variable* + v:mouse_winid Window ID for a mouse click obtained with |getchar()|. + The value is zero when there was no mouse button click. + *v:mouse_lnum* *mouse_lnum-variable* v:mouse_lnum Line number for a mouse click obtained with |getchar()|. This is the text line number, not the screen line number. The *************** *** 3795,3802 **** When the user clicks a mouse button, the mouse event will be returned. The position can then be found in |v:mouse_col|, ! |v:mouse_lnum| and |v:mouse_win|. This example positions the ! mouse as it would normally happen: > let c = getchar() if c == "\" && v:mouse_win > 0 exe v:mouse_win . "wincmd w" --- 3854,3861 ---- When the user clicks a mouse button, the mouse event will be returned. The position can then be found in |v:mouse_col|, ! |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. This ! example positions the mouse as it would normally happen: > let c = getchar() if c == "\" && v:mouse_win > 0 exe v:mouse_win . "wincmd w" *** ../vim-7.4.1893/src/version.c 2016-06-04 17:58:48.486111677 +0200 --- src/version.c 2016-06-04 18:08:54.810103336 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1894, /**/ -- hundred-and-one symptoms of being an internet addict: 42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth. /// 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 ///