From ed9d2be11db07ed1e31e884004ae65b14991de1a Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 4 Mar 2023 16:06:50 -0500 Subject: highlight directives in ted.cfg --- main.c | 2 -- syntax.c | 5 +++++ ted.cfg | 4 ++-- ted.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index c5c48d3..f5c1dc5 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,4 @@ /* -@TODO: -- higlighlight directives in ted.cfg FUTURE FEATURES: - styles ([color] sections) - for this, it would be nice to have #include in ted.cfg diff --git a/syntax.c b/syntax.c index 6abd1cd..3e9d3d9 100644 --- a/syntax.c +++ b/syntax.c @@ -1190,6 +1190,11 @@ static void syntax_highlight_cfg(SyntaxState *state, const char32_t *line, u32 l return; } + if (!string && is_ted_cfg && line[0] == '%') { + memset(char_types, SYNTAX_PREPROCESSOR, line_len); + return; + } + int backslashes = 0; for (u32 i = 0; i < line_len; ++i) { diff --git a/ted.cfg b/ted.cfg index bf056b5..bd21664 100644 --- a/ted.cfg +++ b/ted.cfg @@ -441,8 +441,8 @@ GLSL = .glsl, .tesc, .tese, .vert, .frag, .geom, .comp HTML = .html, .php, .xhtml XML = .xml, .iml Config = .cfg, .toml -# ted.cfg has its own syntax highlighting for multiline strings. -TedCfg = ted.cfg, .ted.cfg +# ted.cfg has its own syntax highlighting +TedCfg = ted.cfg JavaScript = .js TypeScript = .ts JSON = .json diff --git a/ted.h b/ted.h index 1a22996..3470c5b 100644 --- a/ted.h +++ b/ted.h @@ -70,7 +70,7 @@ enum { LANG_JAVA = 10, /// Go LANG_GO = 11, - /// like \ref LANG_CONFIG, but with multiline strings. + /// like \ref LANG_CONFIG, but with more highlighting for ted.cfg-specific stuff. LANG_TED_CFG = 12, /// TypeScript LANG_TYPESCRIPT = 13, -- cgit v1.2.3