summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-06-04 18:09:59 +0200
committerBram Moolenaar <Bram@vim.org>2016-06-04 18:09:59 +0200
commit511972d810ea490955161ff5097ec2f57919ceaf (patch)
tree757238cc7995f8e15f91318205655b7120b183b9
parentb3619a90eae2702553ff9494ecc4c9b20c13c224 (diff)
downloadvim-git-511972d810ea490955161ff5097ec2f57919ceaf.tar.gz
patch 7.4.1894v7.4.1894
Problem: Cannot get the window ID for a mouse click. Solution: Add v:mouse_winid.
-rw-r--r--runtime/doc/eval.txt33
-rw-r--r--src/eval.c3
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h41
4 files changed, 51 insertions, 28 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index b3262b21c..9cc854f93 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2016 May 25
+*eval.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1358,6 +1358,10 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only
window has number zero (unlike most other places where a
window gets a number).
+ *v:beval_winid* *beval_winid-variable*
+v:beval_winid The window ID of the window, over which the mouse pointer is.
+ Otherwise like v:beval_winnr.
+
*v:char* *char-variable*
v:char Argument for evaluating 'formatexpr' and used for the typed
character when using <expr> in an abbreviation |:map-<expr>|.
@@ -1591,6 +1595,10 @@ v:mouse_win Window number for a mouse click obtained with |getchar()|.
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
@@ -1821,7 +1829,7 @@ v:windowid When any X11 based GUI is running or when running in a
When an MS-Windows GUI is running this will be set to the
window handle.
Otherwise the value is zero.
- Note: for windows inside Vim use |winnr()|.
+ Note: for windows inside Vim use |winnr()| or |win_getid()|.
==============================================================================
4. Builtin Functions *functions*
@@ -3846,8 +3854,8 @@ getchar([expr]) *getchar()*
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: >
+ |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 == "\<LeftMouse>" && v:mouse_win > 0
exe v:mouse_win . "wincmd w"
@@ -4724,6 +4732,10 @@ job_status({job}) *job_status()* *E916*
"fail" job failed to start
"dead" job died or was stopped after running
+ On Unix a non-existing command results in "dead" instead of
+ "fail", because a fork happens before the failure can be
+ detected.
+
If an exit callback was set with the "exit_cb" option and the
job is now detected to be "dead" the callback will be invoked.
@@ -6369,10 +6381,15 @@ setqflist({list} [, {action}]) *setqflist()*
*E927*
If {action} is set to 'a', then the items from {list} are
added to the existing quickfix list. If there is no existing
- list, then a new list is created. If {action} is set to 'r',
- then the items from the current quickfix list are replaced
- with the items from {list}. If {action} is not present or is
- set to ' ', then a new list is created.
+ list, then a new list is created.
+
+ If {action} is set to 'r', then the items from the current
+ quickfix list are replaced with the items from {list}. This
+ can also be used to clear the list: >
+ :call setqflist([], 'r')
+<
+ If {action} is not present or is set to ' ', then a new list
+ is created.
Returns zero for success, -1 for failure.
diff --git a/src/eval.c b/src/eval.c
index 66cf3a0cc..2a7a0906f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -359,6 +359,7 @@ static struct vimvar
{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,6 +12756,7 @@ f_getchar(typval_T *argvars, typval_T *rettv)
--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,6 +12812,7 @@ f_getchar(typval_T *argvars, typval_T *rettv)
++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;
}
diff --git a/src/version.c b/src/version.c
index 36b5ed773..b83cb3323 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1894,
+/**/
1893,
/**/
1892,
diff --git a/src/vim.h b/src/vim.h
index 55289aaf6..fb991dcfa 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1887,26 +1887,27 @@ typedef int sock_T;
#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 */
+#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