diff src/eval.c @ 14964:2c0bfa167468 v8.1.0493

patch 8.1.0493: argv() and argc() only work on the current argument list commit https://github.com/vim/vim/commit/e6e3989c1b3f18907a0c305712b867e9a3821369 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 25 12:32:11 2018 +0200 patch 8.1.0493: argv() and argc() only work on the current argument list Problem: argv() and argc() only work on the current argument list. Solution: Add a window ID argument. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/832)
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Oct 2018 12:45:05 +0200
parents 162d79d273e6
children c5ec5ddbe814
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -8193,9 +8193,7 @@ find_win_by_nr(
     tabpage_T	*tp)	/* NULL for current tab page */
 {
     win_T	*wp;
-    int		nr;
-
-    nr = (int)get_tv_number_chk(vp, NULL);
+    int		nr = (int)get_tv_number_chk(vp, NULL);
 
     if (nr < 0)
 	return NULL;
@@ -8218,6 +8216,20 @@ find_win_by_nr(
 }
 
 /*
+ * Find a window: When using a Window ID in any tab page, when using a number
+ * in the current tab page.
+ */
+    win_T *
+find_win_by_nr_or_id(typval_T *vp)
+{
+    int	nr = (int)get_tv_number_chk(vp, NULL);
+
+    if (nr >= LOWEST_WIN_ID)
+	return win_id2wp(vp);
+    return find_win_by_nr(vp, NULL);
+}
+
+/*
  * Find window specified by "wvp" in tabpage "tvp".
  */
     win_T *