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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user