Another refresh: the previous patch had a wrong `vim_free(v)`, which could
cause a segfault.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index eb7fcbc..ef68423 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1955,11 +1955,12 @@ serverlist() String get a list of available servers
setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val}
setcmdpos( {pos}) Number set cursor position in command-line
setline( {lnum}, {line}) Number set line {lnum} to {line}
-setloclist( {nr}, {list}[, {action}])
+setloclist( {nr}, {list}[, {action}[, {title}]])
Number modify location list using {list}
setmatches( {list}) Number restore a list of matches
setpos( {expr}, {list}) Number set the {expr} position to {list}
-setqflist( {list}[, {action}]) Number modify quickfix list using {list}
+setqflist( {list}[, {action}[, {title}]])
+ Number modify quickfix list using {list}
setreg( {n}, {v}[, {opt}]) Number set register to value and type
settabvar( {nr}, {varname}, {val}) set {varname} in tab page {nr} to {val}
settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window
@@ -5364,11 +5365,12 @@ setline({lnum}, {text}) *setline()*
:endfor
< Note: The '[ and '] marks are not set.
-setloclist({nr}, {list} [, {action}]) *setloclist()*
+setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()*
Create or replace or add to the location list for window {nr}.
When {nr} is zero the current window is used. For a location
list window, the displayed location list is modified. For an
- invalid window number {nr}, -1 is returned.
+ invalid window number {nr}, -1 is returned. If {title} is
+ given, it will be stored in the variable |w:quickfix_title|.
Otherwise, same as |setqflist()|.
Also see |location-list|.
@@ -5425,7 +5427,7 @@ setpos({expr}, {list})
|winrestview()|.
-setqflist({list} [, {action}]) *setqflist()*
+setqflist({list} [, {action}[, {title}]]) *setqflist()*
Create or replace or add to the quickfix list using the items
in {list}. Each item in {list} is a dictionary.
Non-dictionary items in {list} are ignored. Each dictionary
@@ -5462,7 +5464,8 @@ setqflist({list} [, {action}]) *setqflist()*
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.
+ set to ' ', then a new list is created. If {title} is
+ given, it will be stored in the variable |w:quickfix_title|.
Returns zero for success, -1 for failure.
diff --git a/src/eval.c b/src/eval.c
index 8f62cb2..684cfd7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8147,10 +8147,10 @@ static struct fst
{"setbufvar", 3, 3, f_setbufvar},
{"setcmdpos", 1, 1, f_setcmdpos},
{"setline", 2, 2, f_setline},
- {"setloclist", 2, 3, f_setloclist},
+ {"setloclist", 2, 4, f_setloclist},
{"setmatches", 1, 1, f_setmatches},
{"setpos", 2, 2, f_setpos},
- {"setqflist", 1, 2, f_setqflist},
+ {"setqflist", 1, 3, f_setqflist},
{"setreg", 2, 3, f_setreg},
{"settabvar", 3, 3, f_settabvar},
{"settabwinvar", 4, 4, f_settabwinvar},
@@ -16853,21 +16853,23 @@ f_setline(argvars, rettv)
appended_lines_mark(lcount, added);
}
-static void set_qf_ll_list __ARGS((win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *rettv));
+static void set_qf_ll_list __ARGS((win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *title_arg, typval_T *rettv));
/*
* Used by "setqflist()" and "setloclist()" functions
*/
static void
-set_qf_ll_list(wp, list_arg, action_arg, rettv)
+set_qf_ll_list(wp, list_arg, action_arg, title_arg, rettv)
win_T *wp UNUSED;
typval_T *list_arg UNUSED;
typval_T *action_arg UNUSED;
+ typval_T *title_arg UNUSED;
typval_T *rettv;
{
#ifdef FEAT_QUICKFIX
char_u *act;
int action = ' ';
+ char_u *title = NULL;
#endif
rettv->vval.v_number = -1;
@@ -16887,9 +16889,16 @@ set_qf_ll_list(wp, list_arg, action_arg, rettv)
if (*act == 'a' || *act == 'r')
action = *act;
}
+ if (title_arg->v_type == VAR_STRING)
+ {
+ title = get_tv_string_chk(title_arg);
+ if (title == NULL)
+ return; /* type error; errmsg already given */
+ }
+ if (title == NULL)
+ title = (char_u*)(wp == NULL ? "setqflist()" : "setloclist()");
- if (l != NULL && set_errorlist(wp, l, action,
- (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
+ if (l != NULL && set_errorlist(wp, l, action, title) == OK)
rettv->vval.v_number = 0;
}
#endif
@@ -16909,7 +16918,7 @@ f_setloclist(argvars, rettv)
win = find_win_by_nr(&argvars[0], NULL);
if (win != NULL)
- set_qf_ll_list(win, &argvars[1], &argvars[2], rettv);
+ set_qf_ll_list(win, &argvars[1], &argvars[2], &argvars[3], rettv);
}
/*
@@ -17027,7 +17036,7 @@ f_setqflist(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
- set_qf_ll_list(NULL, &argvars[0], &argvars[1], rettv);
+ set_qf_ll_list(NULL, &argvars[0], &argvars[1], &argvars[2], rettv);
}
/*
@@ -17282,7 +17291,18 @@ setwinvar(argvars, rettv, off)
vim_free(winvarname);
}
}
+ if (STRCMP(varname, "quickfix_title") == 0)
+ {
+ dictitem_T *v;
+
+ v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE);
+ if (v != NULL)
+ {
+ win_set_qf_title(save_curwin, (&v->di_tv)->vval.v_string);
+ }
+ }
}
+
#ifdef FEAT_WINDOWS
restore_win(save_curwin, save_curtab, TRUE);
#endif
diff --git a/src/proto/quickfix.pro b/src/proto/quickfix.pro
index a5c690f..86dd4c0 100644
--- a/src/proto/quickfix.pro
+++ b/src/proto/quickfix.pro
@@ -5,6 +5,7 @@ void copy_loclist __ARGS((win_T *from, win_T *to));
void qf_jump __ARGS((qf_info_T *qi, int dir, int errornr, int forceit));
void qf_list __ARGS((exarg_T *eap));
void qf_age __ARGS((exarg_T *eap));
+void win_set_qf_title __ARGS((win_T *wp, char_u *title));
void qf_mark_adjust __ARGS((win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after));
void ex_cwindow __ARGS((exarg_T *eap));
void ex_cclose __ARGS((exarg_T *eap));
diff --git a/src/quickfix.c b/src/quickfix.c
index c8954cc..bc380e1 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2629,6 +2629,27 @@ qf_set_title_var(qi)
qi->qf_lists[qi->qf_curlist].qf_title);
}
+ void
+win_set_qf_title(wp, title)
+ win_T *wp;
+ char_u *title;
+{
+ qf_info_T *qi;
+
+ if (IS_LL_WINDOW(wp))
+ qi = wp->w_llist_ref;
+ else if (IS_QF_WINDOW(wp))
+ qi = &ql_info;
+ else
+ return;
+
+ if (title != NULL)
+ {
+ qf_free(qi, qi->qf_curlist);
+ qf_store_title(qi, title);
+ }
+}
+
/*
* Fill current buffer with quickfix errors, replacing any previous contents.
* curbuf must be the quickfix buffer!