/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
/*
* match.c: functions for highlighting matches
*/
#include "vim.h"
#if defined(FEAT_SEARCH_EXTRA) || defined(PROTO)
# define SEARCH_HL_PRIORITY 0
/*
* Add match to the match list of window "wp".
* If "pat" is not NULL the pattern will be highlighted with the group "grp"
* with priority "prio".
* If "pos_list" is not NULL the list of posisions defines the highlights.
* Optionally, a desired ID "id" can be specified (greater than or equal to 1).
* If no particular ID is desired, -1 must be specified for "id".
* Return ID of added match, -1 on failure.
*/
static int
match_add(
win_T *wp,
char_u *grp,
char_u *pat,
int prio,
int id,
list_T *pos_list,
char_u *conceal_char UNUSED) // pointer to conceal replacement char
{
matchitem_T *cur;
matchitem_T *prev;
matchitem_T *m;
int hlg_id;
regprog_T *regprog = NULL;
int rtype = UPD_SOME_VALID;
if (*grp == NUL || (pat != NULL && *pat == NUL))
return -1;
if (id < -1 || id == 0)
{
semsg(_(e_invalid_id_nr_must_be_greater_than_or_equal_to_one_1), id);
return -1;
}
if (id == -1)
{
// use the next available match ID