aboutsummaryrefslogtreecommitdiff
path: root/src/ui/source_view.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-29 22:33:29 +0200
committerhachem <im@hachem.wtf>2026-08-29 22:33:29 +0200
commit73c781e9856ba13e397418a9eed2c7c7a3daec1d (patch)
treeef0a492129f1bc122cebf43cd3ce562b673e1286 /src/ui/source_view.h
parent27181ae7dc81499dd3912849be7642a6f2fbceeb (diff)
feat: syntax highlighting
Diffstat (limited to 'src/ui/source_view.h')
-rw-r--r--src/ui/source_view.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ui/source_view.h b/src/ui/source_view.h
index 94855e8..d3b3ed5 100644
--- a/src/ui/source_view.h
+++ b/src/ui/source_view.h
@@ -11,6 +11,26 @@ namespace Hsdbg
{
class Debugger;
+ // one coloured run inside a source line; start and length index into the
+ // line's own string so the spans stay valid as long as the line does
+ enum class SyntaxKind : uint8_t
+ {
+ Default,
+ Keyword,
+ Type,
+ String,
+ Number,
+ Comment,
+ Preprocessor,
+ };
+
+ struct SourceSpan
+ {
+ uint32_t start;
+ uint32_t length;
+ SyntaxKind kind;
+ };
+
class SourceView
{
public:
@@ -31,6 +51,8 @@ namespace Hsdbg
std::filesystem::path m_path;
std::vector<std::string> m_lines;
+ std::vector<std::vector<SourceSpan>> m_spans;
+ bool m_highlight = false;
std::string m_path_input;
std::string m_error;
uint32_t m_highlighted_line = 0;