summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-01 19:58:27 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-01 19:58:27 -0500
commitbb9c6b6ff3ca196977f9ddd73120897c679e2515 (patch)
treeab908d86a55cb6266a10851d9a3fb2a492089e05 /ted.h
parent01bfdf98e4475e13e7b4bb8b8fbd382fa836986e (diff)
cache syntax highlighting
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/ted.h b/ted.h
index a88c460..df41766 100644
--- a/ted.h
+++ b/ted.h
@@ -18,7 +18,7 @@ enum {
SYNTAX_STATE_STRING = 1<<SYNTAX_STATE_STRING_SHIFT,
};
-typedef u16 SyntaxState;
+typedef u8 SyntaxState;
ENUM_U16 {
LANG_NONE,
@@ -89,6 +89,7 @@ typedef struct {
} BufferPos;
typedef struct {
+ SyntaxState syntax;
u32 len;
u32 capacity;
char32_t *str;
@@ -116,6 +117,12 @@ typedef struct {
float x1, y1, x2, y2;
u32 nlines;
u32 lines_capacity;
+
+ // to cache syntax highlighting properly, it is important to keep track of the
+ // first and last line modified since last frame.
+ u32 frame_earliest_line_modified;
+ u32 frame_latest_line_modified;
+
Line *lines;
char error[256];
BufferEdit *undo_history; // dynamic array of undo history