0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.4.344

Problem:    Unessecary initializations and other things related to
            matchaddpos().
Solution:   Code cleanup. (Alexey Radkov)
This commit is contained in:
Bram Moolenaar
2014-06-25 18:15:22 +02:00
parent 41d7523986
commit b6da44ae82
4 changed files with 14 additions and 15 deletions

View File

@@ -4391,17 +4391,17 @@ matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()*
required, for example to highlight matching parentheses. required, for example to highlight matching parentheses.
The list {pos} can contain one of these items: The list {pos} can contain one of these items:
- A number. This while line will be highlighted. The first - A number. This whole line will be highlighted. The first
line has number 1. line has number 1.
- A list with one number, e.g., [23]. The whole line with this - A list with one number, e.g., [23]. The whole line with this
number will be highlighted. number will be highlighted.
- A list with two numbers, e.g., [23, 11]. The first number is - A list with two numbers, e.g., [23, 11]. The first number is
the line number, the second one the column number (first the line number, the second one is the column number (first
column is 1). The character at this position will be column is 1, the value must correspond to the byte index as
highlighted. |col()| would return). The character at this position will
be highlighted.
- A list with three numbers, e.g., [23, 11, 3]. As above, but - A list with three numbers, e.g., [23, 11, 3]. As above, but
the third number gives the length of the highlight in screen the third number gives the length of the highlight in bytes.
cells.
The maximum number of positions is 8. The maximum number of positions is 8.

View File

@@ -7531,7 +7531,7 @@ next_search_hl_pos(shl, lnum, posmatch, mincol)
colnr_T mincol; /* minimal column for a match */ colnr_T mincol; /* minimal column for a match */
{ {
int i; int i;
int bot = -1; int bot = -1;
shl->lnum = 0; shl->lnum = 0;
for (i = posmatch->cur; i < MAXPOSMATCH; i++) for (i = posmatch->cur; i < MAXPOSMATCH; i++)

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
344,
/**/ /**/
343, 343,
/**/ /**/

View File

@@ -6813,7 +6813,6 @@ match_add(wp, grp, pat, prio, id, pos_list)
m->id = id; m->id = id;
m->priority = prio; m->priority = prio;
m->pattern = pat == NULL ? NULL : vim_strsave(pat); m->pattern = pat == NULL ? NULL : vim_strsave(pat);
m->pos.cur = 0;
m->hlg_id = hlg_id; m->hlg_id = hlg_id;
m->match.regprog = regprog; m->match.regprog = regprog;
m->match.rmm_ic = FALSE; m->match.rmm_ic = FALSE;
@@ -6827,7 +6826,7 @@ match_add(wp, grp, pat, prio, id, pos_list)
listitem_T *li; listitem_T *li;
int i; int i;
for (i = 0, li = pos_list->lv_first; i < MAXPOSMATCH; for (i = 0, li = pos_list->lv_first; li != NULL && i < MAXPOSMATCH;
i++, li = li->li_next) i++, li = li->li_next)
{ {
linenr_T lnum = 0; linenr_T lnum = 0;
@@ -6837,11 +6836,6 @@ match_add(wp, grp, pat, prio, id, pos_list)
listitem_T *subli; listitem_T *subli;
int error = FALSE; int error = FALSE;
if (li == NULL)
{
m->pos.pos[i].lnum = 0;
break;
}
if (li->li_tv.v_type == VAR_LIST) if (li->li_tv.v_type == VAR_LIST)
{ {
subl = li->li_tv.vval.v_list; subl = li->li_tv.vval.v_list;
@@ -6853,12 +6847,12 @@ match_add(wp, grp, pat, prio, id, pos_list)
lnum = get_tv_number_chk(&subli->li_tv, &error); lnum = get_tv_number_chk(&subli->li_tv, &error);
if (error == TRUE) if (error == TRUE)
goto fail; goto fail;
m->pos.pos[i].lnum = lnum;
if (lnum == 0) if (lnum == 0)
{ {
--i; --i;
continue; continue;
} }
m->pos.pos[i].lnum = lnum;
subli = subli->li_next; subli = subli->li_next;
if (subli != NULL) if (subli != NULL)
{ {
@@ -6879,7 +6873,10 @@ match_add(wp, grp, pat, prio, id, pos_list)
else if (li->li_tv.v_type == VAR_NUMBER) else if (li->li_tv.v_type == VAR_NUMBER)
{ {
if (li->li_tv.vval.v_number == 0) if (li->li_tv.vval.v_number == 0)
{
--i;
continue; continue;
}
m->pos.pos[i].lnum = li->li_tv.vval.v_number; m->pos.pos[i].lnum = li->li_tv.vval.v_number;
m->pos.pos[i].col = 0; m->pos.pos[i].col = 0;
m->pos.pos[i].len = 0; m->pos.pos[i].len = 0;