required, for example to highlight matching parentheses.
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.
- A list with one number, e.g., [23]. The whole line with this
number will be highlighted.
- A list with two numbers, e.g., [23, 11]. The first number is
- the line number, the second one the column number (first
- column is 1). The character at this position will be
- highlighted.
+ the line number, the second one is the column number (first
+ column is 1, the value must correspond to the byte index as
+ |col()| would return). The character at this position will
+ be highlighted.
- A list with three numbers, e.g., [23, 11, 3]. As above, but
- the third number gives the length of the highlight in screen
- cells.
+ the third number gives the length of the highlight in bytes.
The maximum number of positions is 8.
m->id = id;
m->priority = prio;
m->pattern = pat == NULL ? NULL : vim_strsave(pat);
- m->pos.cur = 0;
m->hlg_id = hlg_id;
m->match.regprog = regprog;
m->match.rmm_ic = FALSE;
listitem_T *li;
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)
{
linenr_T lnum = 0;
listitem_T *subli;
int error = FALSE;
- if (li == NULL)
- {
- m->pos.pos[i].lnum = 0;
- break;
- }
if (li->li_tv.v_type == VAR_LIST)
{
subl = li->li_tv.vval.v_list;
lnum = get_tv_number_chk(&subli->li_tv, &error);
if (error == TRUE)
goto fail;
- m->pos.pos[i].lnum = lnum;
if (lnum == 0)
{
--i;
continue;
}
+ m->pos.pos[i].lnum = lnum;
subli = subli->li_next;
if (subli != NULL)
{
else if (li->li_tv.v_type == VAR_NUMBER)
{
if (li->li_tv.vval.v_number == 0)
+ {
+ --i;
continue;
+ }
m->pos.pos[i].lnum = li->li_tv.vval.v_number;
m->pos.pos[i].col = 0;
m->pos.pos[i].len = 0;