summaryrefslogtreecommitdiff
path: root/src/structs.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-06-17 17:48:32 +0200
committerBram Moolenaar <Bram@vim.org>2014-06-17 17:48:32 +0200
commitb3414595c713ca161f082776f89417faddec7d2d (patch)
tree5f03f600e04a2455ce84033c49db30b680d571c6 /src/structs.h
parentec1561cac59006213dd5405d164a94dc7d002806 (diff)
downloadvim-git-7.4.330.tar.gz
updated for version 7.4.330v7.4.330
Problem: Using a regexp pattern to highlight a specific position can be slow. Solution: Add matchaddpos() to highlight specific positions efficiently. (Alexey Radkov)
Diffstat (limited to 'src/structs.h')
-rw-r--r--src/structs.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/structs.h b/src/structs.h
index 6f953002d..c3d55cb30 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1927,6 +1927,32 @@ typedef struct
#endif
} match_T;
+/* number of positions supported by matchaddpos() */
+#define MAXPOSMATCH 8
+
+/*
+ * Same as lpos_T, but with additional field len.
+ */
+typedef struct
+{
+ linenr_T lnum; /* line number */
+ colnr_T col; /* column number */
+ int len; /* length: 0 - to the end of line */
+} llpos_T;
+
+/*
+ * posmatch_T provides an array for storing match items for matchaddpos()
+ * function.
+ */
+typedef struct posmatch posmatch_T;
+struct posmatch
+{
+ llpos_T pos[MAXPOSMATCH]; /* array of positions */
+ int cur; /* internal position counter */
+ linenr_T toplnum; /* top buffer line */
+ linenr_T botlnum; /* bottom buffer line */
+};
+
/*
* matchitem_T provides a linked list for storing match items for ":match" and
* the match functions.
@@ -1940,6 +1966,7 @@ struct matchitem
char_u *pattern; /* pattern to highlight */
int hlg_id; /* highlight group ID */
regmmatch_T match; /* regexp program for pattern */
+ posmatch_T pos; /* position matches */
match_T hl; /* struct for doing the actual highlighting */
};