mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.312
Problem: Cannot figure out what argument list is being used for a window. Solution: Add the arglistid() function. (Marcin Szamotulski) https://code.google.com/p/vim/source/detail?r=v7-4-312
This commit is contained in:
parent
1761a4af71
commit
def28adfdd
@ -255,6 +255,7 @@ struct wininfo_S {
|
|||||||
typedef struct arglist {
|
typedef struct arglist {
|
||||||
garray_T al_ga; /* growarray with the array of file names */
|
garray_T al_ga; /* growarray with the array of file names */
|
||||||
int al_refcount; /* number of windows using this arglist */
|
int al_refcount; /* number of windows using this arglist */
|
||||||
|
int id; ///< id of this arglist
|
||||||
} alist_T;
|
} alist_T;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6311,6 +6311,7 @@ static struct fst {
|
|||||||
{"append", 2, 2, f_append},
|
{"append", 2, 2, f_append},
|
||||||
{"argc", 0, 0, f_argc},
|
{"argc", 0, 0, f_argc},
|
||||||
{"argidx", 0, 0, f_argidx},
|
{"argidx", 0, 0, f_argidx},
|
||||||
|
{"arglistid", 0, 2, f_arglistid},
|
||||||
{"argv", 0, 1, f_argv},
|
{"argv", 0, 1, f_argv},
|
||||||
{"asin", 1, 1, f_asin}, /* WJMc */
|
{"asin", 1, 1, f_asin}, /* WJMc */
|
||||||
{"atan", 1, 1, f_atan},
|
{"atan", 1, 1, f_atan},
|
||||||
@ -7203,6 +7204,32 @@ static void f_argidx(typval_T *argvars, typval_T *rettv)
|
|||||||
rettv->vval.v_number = curwin->w_arg_idx;
|
rettv->vval.v_number = curwin->w_arg_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// "arglistid" function
|
||||||
|
static void f_arglistid(typval_T *argvars, typval_T *rettv)
|
||||||
|
{
|
||||||
|
rettv->vval.v_number = -1;
|
||||||
|
if (argvars[0].v_type != VAR_UNKNOWN) {
|
||||||
|
tabpage_T *tp = NULL;
|
||||||
|
if (argvars[1].v_type != VAR_UNKNOWN) {
|
||||||
|
long n = get_tv_number(&argvars[1]);
|
||||||
|
if (n >= 0) {
|
||||||
|
tp = find_tabpage(n);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tp = curtab;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tp != NULL) {
|
||||||
|
win_T *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
|
* "argv(nr)" function
|
||||||
*/
|
*/
|
||||||
|
@ -5504,6 +5504,7 @@ void alist_new(void)
|
|||||||
{
|
{
|
||||||
curwin->w_alist = xmalloc(sizeof(*curwin->w_alist));
|
curwin->w_alist = xmalloc(sizeof(*curwin->w_alist));
|
||||||
curwin->w_alist->al_refcount = 1;
|
curwin->w_alist->al_refcount = 1;
|
||||||
|
curwin->w_alist->id = ++max_alist_id;
|
||||||
alist_init(curwin->w_alist);
|
alist_init(curwin->w_alist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,6 +568,7 @@ EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */
|
|||||||
* to this when the window is using the global argument list.
|
* to this when the window is using the global argument list.
|
||||||
*/
|
*/
|
||||||
EXTERN alist_T global_alist; /* 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
|
EXTERN int arg_had_last INIT(= FALSE); /* accessed last file in
|
||||||
global_alist */
|
global_alist */
|
||||||
|
|
||||||
|
@ -192,6 +192,7 @@ int main(int argc, char **argv)
|
|||||||
init_yank(); /* init yank buffers */
|
init_yank(); /* init yank buffers */
|
||||||
|
|
||||||
alist_init(&global_alist); /* Init the argument list to empty. */
|
alist_init(&global_alist); /* Init the argument list to empty. */
|
||||||
|
global_alist.id = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the default values for the options.
|
* Set the default values for the options.
|
||||||
|
@ -283,7 +283,7 @@ static int included_patches[] = {
|
|||||||
315,
|
315,
|
||||||
314,
|
314,
|
||||||
//313,
|
//313,
|
||||||
//312,
|
312,
|
||||||
//311,
|
//311,
|
||||||
//310,
|
//310,
|
||||||
309,
|
309,
|
||||||
|
Loading…
Reference in New Issue
Block a user