diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-05-28 18:22:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-05-28 18:22:57 +0200 |
commit | 2d1fe05fc06a91886635680886c200ad90f0abd7 (patch) | |
tree | 16faee30e75a2fd0156634661b452e813877e2bd /src | |
parent | 82c2585eb840a84240ef927c09df28d5a04302b1 (diff) |
updated for version 7.4.312v7.4.312
Problem: Cannot figure out what argument list is being used for a window.
Solution: Add the arglistid() function. (Marcin Szamotulski)
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 37 | ||||
-rw-r--r-- | src/ex_docmd.c | 1 | ||||
-rw-r--r-- | src/globals.h | 1 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/structs.h | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
6 files changed, 43 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index d313c5d030..0e9ec9ed0a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -463,6 +463,7 @@ static void f_and __ARGS((typval_T *argvars, typval_T *rettv)); static void f_append __ARGS((typval_T *argvars, typval_T *rettv)); static void f_argc __ARGS((typval_T *argvars, typval_T *rettv)); static void f_argidx __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_arglistid __ARGS((typval_T *argvars, typval_T *rettv)); static void f_argv __ARGS((typval_T *argvars, typval_T *rettv)); #ifdef FEAT_FLOAT static void f_asin __ARGS((typval_T *argvars, typval_T *rettv)); @@ -7875,6 +7876,7 @@ static struct fst {"append", 2, 2, f_append}, {"argc", 0, 0, f_argc}, {"argidx", 0, 0, f_argidx}, + {"arglistid", 0, 2, f_arglistid}, {"argv", 0, 1, f_argv}, #ifdef FEAT_FLOAT {"asin", 1, 1, f_asin}, /* WJMc */ @@ -8859,6 +8861,41 @@ f_argidx(argvars, rettv) } /* + * "arglistid()" function + */ + static void +f_arglistid(argvars, rettv) + typval_T *argvars UNUSED; + typval_T *rettv; +{ + win_T *wp; + tabpage_T *tp = NULL; + long n; + + rettv->vval.v_number = -1; + if (argvars[0].v_type != VAR_UNKNOWN) + { + if (argvars[1].v_type != VAR_UNKNOWN) + { + n = get_tv_number(&argvars[1]); + if (n >= 0) + tp = find_tabpage(n); + } + else + tp = curtab; + + if (tp != NULL) + { + wp = find_win_by_nr(&argvars[0], tp); + if (wp != NULL) + rettv->vval.v_number = wp->w_alist->id; + } + } + else + rettv->vval.v_number = curwin->w_alist->id; +} + +/* * "argv(nr)" function */ static void diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a7df2c31aa..04c9a61cfa 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7211,6 +7211,7 @@ alist_new() else { curwin->w_alist->al_refcount = 1; + curwin->w_alist->id = ++max_alist_id; alist_init(curwin->w_alist); } } diff --git a/src/globals.h b/src/globals.h index 058341b117..d831db9f82 100644 --- a/src/globals.h +++ b/src/globals.h @@ -601,6 +601,7 @@ EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */ * to this when the window is using the global argument list. */ EXTERN alist_T global_alist; /* global argument list */ +EXTERN int max_alist_id INIT(= 0); /* the previous argument list id */ EXTERN int arg_had_last INIT(= FALSE); /* accessed last file in global_alist */ diff --git a/src/main.c b/src/main.c index c29d6be235..9c92f7a844 100644 --- a/src/main.c +++ b/src/main.c @@ -322,6 +322,7 @@ main init_yank(); /* init yank buffers */ alist_init(&global_alist); /* Init the argument list to empty. */ + global_alist.id = 0; /* * Set the default values for the options. diff --git a/src/structs.h b/src/structs.h index 16a20716a4..6f953002d2 100644 --- a/src/structs.h +++ b/src/structs.h @@ -675,6 +675,7 @@ typedef struct arglist { garray_T al_ga; /* growarray with the array of file names */ int al_refcount; /* number of windows using this arglist */ + int id; /* id of this arglist */ } alist_T; /* diff --git a/src/version.c b/src/version.c index 85ab6800a9..b3ec0d3186 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 312, +/**/ 311, /**/ 310, |