Improve highlighting structure

- switched to a sparse delta based map
- true lazy-loading to avoid any unneccessary allocations
- fixed windows management api
This commit is contained in:
2026-02-11 18:18:28 +00:00
parent d79ea4e75a
commit 5b66f503e4
24 changed files with 481 additions and 549 deletions

View File

@@ -6,6 +6,8 @@
#include "pch.h"
#include "syntax/trie.h"
#define MAX_LINES_LOOKBEHIND 80
struct Highlight {
uint32_t fg{0xFFFFFF};
uint32_t bg{0x000000};
@@ -35,10 +37,23 @@ struct Token {
TokenKind type;
};
struct StateBase {
virtual ~StateBase() = default;
virtual std::unique_ptr<StateBase> clone() const = 0;
};
struct CustomState : StateBase {
std::string value;
explicit CustomState(std::string v) : value(std::move(v)) {}
std::unique_ptr<StateBase> clone() const override {
return std::make_unique<CustomState>(value);
}
};
struct LineData {
std::shared_ptr<void> in_state{nullptr};
std::unique_ptr<StateBase> out_state;
std::vector<Token> tokens;
std::shared_ptr<void> out_state{nullptr};
std::unique_ptr<StateBase> in_state;
};
#endif