summaryrefslogtreecommitdiff
path: root/syntax.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-04 23:19:01 -0500
committerpommicket <pommicket@gmail.com>2023-01-04 23:19:01 -0500
commitd7cd9edb84d9403eca0d4caae68815c12c560164 (patch)
tree607eb4a7ea9ffc821432bdcf6f86c10dbccce859 /syntax.c
parent629ce76eb480d63fdd57769a0d9972a1a0c0fbea (diff)
highlight matching < > for HTML
Diffstat (limited to 'syntax.c')
-rw-r--r--syntax.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/syntax.c b/syntax.c
index 2d9dd15..1e4f084 100644
--- a/syntax.c
+++ b/syntax.c
@@ -124,7 +124,17 @@ static bool syntax_keyword_matches(const char32_t *text, size_t len, const char
}
char32_t syntax_matching_bracket(Language lang, char32_t c) {
- (void)lang; // not needed yet
+ if (lang == LANG_HTML) {
+ // for most languages, this would look weird since
+ // v cursor
+ // if (x < 5 && y >| 6)
+ // ^ this will be highlighted as a "matching bracket"
+ // but for HTML this is nice
+ switch (c) {
+ case '<': return '>';
+ case '>': return '<';
+ }
+ }
switch (c) {
case '(': return ')';
case ')': return '(';
@@ -137,7 +147,10 @@ char32_t syntax_matching_bracket(Language lang, char32_t c) {
}
bool syntax_is_opening_bracket(Language lang, char32_t c) {
- (void)lang;
+ if (lang == LANG_HTML) {
+ if (c == '<')
+ return true;
+ }
switch (c) {
case '(':
case '[':