From 6148ea652c3e396a12e739a7d84c1a2e46255485 Mon Sep 17 00:00:00 2001 From: pommicket Date: Thu, 20 Jul 2023 16:44:49 -0400 Subject: fix highlighting of self-closing tags in JSX files --- main.c | 2 ++ syntax.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/main.c b/main.c index c9da289..d7979d4 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,6 @@ /* +TODO: +- windows UI scaling FUTURE FEATURES: - autodetect indentation (tabs vs spaces) - font setting & support for multiple fonts to cover more characters diff --git a/syntax.c b/syntax.c index 87d83cd..fa539f1 100644 --- a/syntax.c +++ b/syntax.c @@ -1404,6 +1404,11 @@ static void syntax_highlight_javascript_like( is_regex = false; } + if (i + 1 < line_len && line[i+1] == '>') { + // slash is followed by equals, so this might be a self-closing JSX tag + is_regex = false; + } + if (is_regex) { in_string = true; string_is_regex = true; -- cgit v1.2.3