Make syntax highlighting smoother

This commit is contained in:
2025-12-30 10:56:31 +00:00
parent 26e0b06e24
commit dc507dfc23
13 changed files with 216 additions and 230 deletions

View File

@@ -33,9 +33,8 @@ struct Editor {
Queue<TSInputEdit> edit_queue;
std::vector<Fold> folds;
Spans spans;
// TODO: Split into 2 groups to have their own mutex's . one for word hl and
// one for hex colors
Spans def_spans;
Spans word_spans;
Spans hex_color_spans;
uint32_t hooks[94];
bool jumper_set;
std::shared_mutex v_mtx;

View File

@@ -7,7 +7,7 @@
struct Spans {
std::vector<Span> spans;
Queue<std::pair<uint32_t, int64_t>> edits;
bool mid_parse = false;
std::atomic<bool> mid_parse = false;
std::shared_mutex mtx;
};

View File

@@ -159,8 +159,10 @@ char *leaf_from_offset(Knot *root, uint32_t start_offset, uint32_t *out_len);
// compliant) I.e some forms of backtracking etc. are not supported
// root is the root of the rope to be searched
// Returns a vector of pairs of start and length offsets (in bytes)
std::vector<std::pair<size_t, size_t>> search_rope(Knot *root,
const char *pattern);
std::vector<std::pair<size_t, size_t>> search_rope_dfa(Knot *root,
const char *pattern);
std::vector<Match> search_rope(Knot *root, const char *pattern);
// Helper function to free the rope
// root is the root of the rope