mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 07:48:18 +00:00
Merge pull request #4129 from jbradaric/vim-7.4.745
vim-patch:7.4.{745,746,747,748}
This commit is contained in:
@@ -15209,6 +15209,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv)
|
|||||||
list_T *l;
|
list_T *l;
|
||||||
listitem_T *li;
|
listitem_T *li;
|
||||||
dict_T *d;
|
dict_T *d;
|
||||||
|
list_T *s = NULL;
|
||||||
|
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
if (argvars[0].v_type != VAR_LIST) {
|
if (argvars[0].v_type != VAR_LIST) {
|
||||||
@@ -15227,7 +15228,8 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(dict_find(d, (char_u *)"group", -1) != NULL
|
if (!(dict_find(d, (char_u *)"group", -1) != NULL
|
||||||
&& dict_find(d, (char_u *)"pattern", -1) != NULL
|
&& (dict_find(d, (char_u *)"pattern", -1) != NULL
|
||||||
|
|| dict_find(d, (char_u *)"pos1", -1) != NULL)
|
||||||
&& dict_find(d, (char_u *)"priority", -1) != NULL
|
&& dict_find(d, (char_u *)"priority", -1) != NULL
|
||||||
&& dict_find(d, (char_u *)"id", -1) != NULL)) {
|
&& dict_find(d, (char_u *)"id", -1) != NULL)) {
|
||||||
EMSG(_(e_invarg));
|
EMSG(_(e_invarg));
|
||||||
@@ -15239,11 +15241,47 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv)
|
|||||||
clear_matches(curwin);
|
clear_matches(curwin);
|
||||||
li = l->lv_first;
|
li = l->lv_first;
|
||||||
while (li != NULL) {
|
while (li != NULL) {
|
||||||
|
int i = 0;
|
||||||
|
char_u buf[5];
|
||||||
|
dictitem_T *di;
|
||||||
d = li->li_tv.vval.v_dict;
|
d = li->li_tv.vval.v_dict;
|
||||||
match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE),
|
|
||||||
get_dict_string(d, (char_u *)"pattern", FALSE),
|
if (dict_find(d, (char_u *)"pattern", -1) == NULL) {
|
||||||
|
if (s == NULL) {
|
||||||
|
s = list_alloc();
|
||||||
|
if (s == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// match from matchaddpos()
|
||||||
|
for (i = 1; i < 9; ++i) {
|
||||||
|
snprintf((char *)buf, sizeof(buf), (char *)"pos%d", i);
|
||||||
|
if ((di = dict_find(d, (char_u *)buf, -1)) != NULL) {
|
||||||
|
if (di->di_tv.v_type != VAR_LIST) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_append_tv(s, &di->di_tv);
|
||||||
|
s->lv_refcount++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
match_add(curwin, get_dict_string(d, (char_u *)"group", false),
|
||||||
|
get_dict_string(d, (char_u *)"pattern", false),
|
||||||
(int)get_dict_number(d, (char_u *)"priority"),
|
(int)get_dict_number(d, (char_u *)"priority"),
|
||||||
(int)get_dict_number(d, (char_u *)"id"), NULL);
|
(int)get_dict_number(d, (char_u *)"id"), NULL);
|
||||||
|
} else {
|
||||||
|
match_add(curwin, get_dict_string(d, (char_u *)"group", false),
|
||||||
|
NULL, (int)get_dict_number(d, (char_u *)"priority"),
|
||||||
|
(int)get_dict_number(d, (char_u *)"id"), s);
|
||||||
|
list_unref(s);
|
||||||
|
s = NULL;
|
||||||
|
}
|
||||||
li = li->li_next;
|
li = li->li_next;
|
||||||
}
|
}
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
|
@@ -1606,13 +1606,12 @@ win_found:
|
|||||||
}
|
}
|
||||||
if (qf_ptr->qf_col > 0) {
|
if (qf_ptr->qf_col > 0) {
|
||||||
curwin->w_cursor.col = qf_ptr->qf_col - 1;
|
curwin->w_cursor.col = qf_ptr->qf_col - 1;
|
||||||
if (qf_ptr->qf_viscol == TRUE) {
|
curwin->w_cursor.coladd = 0;
|
||||||
/*
|
if (qf_ptr->qf_viscol == true) {
|
||||||
* Check each character from the beginning of the error
|
// Check each character from the beginning of the error
|
||||||
* line up to the error column. For each tab character
|
// line up to the error column. For each tab character
|
||||||
* found, reduce the error column value by the length of
|
// found, reduce the error column value by the length of
|
||||||
* a tab character.
|
// a tab character.
|
||||||
*/
|
|
||||||
line = get_cursor_line_ptr();
|
line = get_cursor_line_ptr();
|
||||||
screen_col = 0;
|
screen_col = 0;
|
||||||
for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col) {
|
for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col) {
|
||||||
|
@@ -445,17 +445,10 @@ do_tag (
|
|||||||
tagmatchname = vim_strsave(name);
|
tagmatchname = vim_strsave(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (type == DT_TAG || type == DT_SELECT || type == DT_JUMP
|
||||||
* If a count is supplied to the ":tag <name>" command, then
|
|| type == DT_LTAG) {
|
||||||
* jump to count'th matching tag.
|
|
||||||
*/
|
|
||||||
if (type == DT_TAG && *tag != NUL && count > 0)
|
|
||||||
cur_match = count - 1;
|
|
||||||
|
|
||||||
if (type == DT_SELECT || type == DT_JUMP
|
|
||||||
|| type == DT_LTAG
|
|
||||||
)
|
|
||||||
cur_match = MAXCOL - 1;
|
cur_match = MAXCOL - 1;
|
||||||
|
}
|
||||||
max_num_matches = cur_match + 1;
|
max_num_matches = cur_match + 1;
|
||||||
|
|
||||||
/* when the argument starts with '/', use it as a regexp */
|
/* when the argument starts with '/', use it as a regexp */
|
||||||
@@ -506,18 +499,19 @@ do_tag (
|
|||||||
EMSG2(_("E426: tag not found: %s"), name);
|
EMSG2(_("E426: tag not found: %s"), name);
|
||||||
g_do_tagpreview = 0;
|
g_do_tagpreview = 0;
|
||||||
} else {
|
} else {
|
||||||
int ask_for_selection = FALSE;
|
bool ask_for_selection = false;
|
||||||
|
|
||||||
if (type == DT_CSCOPE && num_matches > 1) {
|
if (type == DT_CSCOPE && num_matches > 1) {
|
||||||
cs_print_tags();
|
cs_print_tags();
|
||||||
ask_for_selection = TRUE;
|
ask_for_selection = true;
|
||||||
} else if (type == DT_SELECT ||
|
} else if (type == DT_TAG) {
|
||||||
(type == DT_JUMP && num_matches > 1)) {
|
// If a count is supplied to the ":tag <name>" command, then
|
||||||
/*
|
// jump to count'th matching tag.
|
||||||
* List all the matching tags.
|
cur_match = count > 0 ? count - 1 : 0;
|
||||||
* Assume that the first match indicates how long the tags can
|
} else if (type == DT_SELECT || (type == DT_JUMP && num_matches > 1)) {
|
||||||
* be, and align the file names to that.
|
// List all the matching tags.
|
||||||
*/
|
// Assume that the first match indicates how long the tags can
|
||||||
|
// be, and align the file names to that.
|
||||||
parse_match(matches[0], &tagp);
|
parse_match(matches[0], &tagp);
|
||||||
taglen = (int)(tagp.tagname_end - tagp.tagname + 2);
|
taglen = (int)(tagp.tagname_end - tagp.tagname + 2);
|
||||||
if (taglen < 18)
|
if (taglen < 18)
|
||||||
@@ -666,9 +660,10 @@ do_tag (
|
|||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
os_breakcheck();
|
os_breakcheck();
|
||||||
}
|
}
|
||||||
if (got_int)
|
if (got_int) {
|
||||||
got_int = FALSE; /* only stop the listing */
|
got_int = false; // only stop the listing
|
||||||
ask_for_selection = TRUE;
|
}
|
||||||
|
ask_for_selection = true;
|
||||||
} else if (type == DT_LTAG) {
|
} else if (type == DT_LTAG) {
|
||||||
list_T *list;
|
list_T *list;
|
||||||
char_u tag_name[128 + 1];
|
char_u tag_name[128 + 1];
|
||||||
@@ -801,10 +796,8 @@ do_tag (
|
|||||||
cur_match = 0; /* Jump to the first tag */
|
cur_match = 0; /* Jump to the first tag */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ask_for_selection == TRUE) {
|
if (ask_for_selection) {
|
||||||
/*
|
// Ask to select a tag from the list.
|
||||||
* Ask to select a tag from the list.
|
|
||||||
*/
|
|
||||||
i = prompt_for_number(NULL);
|
i = prompt_for_number(NULL);
|
||||||
if (i <= 0 || i > num_matches || got_int) {
|
if (i <= 0 || i > num_matches || got_int) {
|
||||||
/* no valid choice: don't change anything */
|
/* no valid choice: don't change anything */
|
||||||
@@ -851,7 +844,7 @@ do_tag (
|
|||||||
|
|
||||||
|
|
||||||
ic = (matches[cur_match][0] & MT_IC_OFF);
|
ic = (matches[cur_match][0] & MT_IC_OFF);
|
||||||
if (type != DT_SELECT && type != DT_JUMP
|
if (type != DT_TAG && type != DT_SELECT && type != DT_JUMP
|
||||||
&& type != DT_CSCOPE
|
&& type != DT_CSCOPE
|
||||||
&& (num_matches > 1 || ic)
|
&& (num_matches > 1 || ic)
|
||||||
&& !skip_msg) {
|
&& !skip_msg) {
|
||||||
|
@@ -414,10 +414,10 @@ static int included_patches[] = {
|
|||||||
// 751 NA
|
// 751 NA
|
||||||
// 750 NA
|
// 750 NA
|
||||||
// 749,
|
// 749,
|
||||||
// 748,
|
748,
|
||||||
// 747,
|
747,
|
||||||
// 746,
|
746,
|
||||||
// 745,
|
745,
|
||||||
// 744 NA
|
// 744 NA
|
||||||
// 743,
|
// 743,
|
||||||
// 742,
|
// 742,
|
||||||
|
@@ -89,7 +89,11 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
|||||||
execute("call clearmatches()")
|
execute("call clearmatches()")
|
||||||
execute("call setmatches(ml)")
|
execute("call setmatches(ml)")
|
||||||
eq(ml, eval('getmatches()'))
|
eq(ml, eval('getmatches()'))
|
||||||
|
|
||||||
|
-- Check that "setmatches()" can correctly restore the matches from matchaddpos()
|
||||||
execute("call clearmatches()")
|
execute("call clearmatches()")
|
||||||
|
execute("call setmatches(ml)")
|
||||||
|
eq(ml, eval('getmatches()'))
|
||||||
|
|
||||||
-- Check that "setmatches()" will not add two matches with the same ID. The
|
-- Check that "setmatches()" will not add two matches with the same ID. The
|
||||||
-- expected behaviour (for now) is to add the first match but not the
|
-- expected behaviour (for now) is to add the first match but not the
|
||||||
|
Reference in New Issue
Block a user