summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-03-04 16:06:50 -0500
committerpommicket <pommicket@gmail.com>2023-03-04 16:06:50 -0500
commited9d2be11db07ed1e31e884004ae65b14991de1a (patch)
tree50d7b3a19089c168d37912143963dbcceff63a16
parent2bdf5709514f5ff4fd734945c883f7789d9cda64 (diff)
highlight directives in ted.cfg
-rw-r--r--main.c2
-rw-r--r--syntax.c5
-rw-r--r--ted.cfg4
-rw-r--r--ted.h2
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,