From 85e906e58202b2ae0ab782f6f411485acfd55f9e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 24 Oct 2026 09:17:41 -1000 Subject: Escape the same characters in the highlighter A lexer may hand back the bytes of one separator, or the CR and LF of a line ending, in different tokens, so line endings become line feeds before lexing and the separators are escaped once the tokens are joined. --- tests/t0502-syntax-highlight.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/t0502-syntax-highlight.sh') diff --git a/tests/t0502-syntax-highlight.sh b/tests/t0502-syntax-highlight.sh index 31ab7e7..ced9edd 100755 --- a/tests/t0502-syntax-highlight.sh +++ b/tests/t0502-syntax-highlight.sh @@ -70,4 +70,15 @@ test_expect_success CGIT_LUA 'bytes between tokens reach the page escaped' ' grep "42 & " tmp ' +test_expect_success CGIT_LUA 'a lone carriage return reaches the page as an escape' ' + ( + cd repos/fake && + printf "if\\rzz\\n" >cr.fake && + git add cr.fake && + git commit -m "add a lone carriage return" + ) && + cgit_url "fake/tree/cr.fake" >tmp && + grep "if\\\\r" tmp +' + test_done -- cgit 2.9.1