From 6cd143f86d3c39be633c1dcf5a4165f2f06a04f6 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 22 Dec 2024 18:16:17 +0300 Subject: fixed lexing (syntax highlighting) of the null-character (^@) in SciTECO code * Apparently g_utf8_get_char_validated() sometimes(!) returns -2 for null-characters, so it was considered an invalid byte sequence. * What's strange and unexplainable is that other uses of the function, as are behind nA and nQq, did not cause problems and returned 0 for null-bytes. * This also fixes syntax higlighting of .teco_session files which use the null-byte as the string terminator. (.teco_session files are not highlighted automatically, though.) --- src/qreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qreg.c') diff --git a/src/qreg.c b/src/qreg.c index 91ee630..271e7cb 100644 --- a/src/qreg.c +++ b/src/qreg.c @@ -539,7 +539,7 @@ teco_qreg_external_get_character(teco_qreg_t *qreg, teco_int_t position, * The sign bit in UCS-4/UTF-32 is unused, so this will even * suffice if TECO_INTEGER == 32. */ - *chr = (gint32)g_utf8_get_char_validated(p, -1); + *chr = *p ? (gint32)g_utf8_get_char_validated(p, -1) : 0; return TRUE; } -- cgit v1.2.3