diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-21 11:32:22 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-21 11:32:22 +0200 |
commit | 49e1f099fd4efe78365f0449522b99bdaa661f8f (patch) | |
tree | 8571f25200f0658785fdc6259deda72a94db444a | |
parent | dc3bbb9d1b2642e1cf2bea7215e369b0ef390698 (diff) | |
download | sciteco-49e1f099fd4efe78365f0449522b99bdaa661f8f.tar.gz |
syntax errors are reported with "echoed" characters, ie. as purely printable characters
* Some characters like LF wouldn't be displayed in the message line correctly.
* In fact the Gtk UI cannot display any of the control characters correctly.
* I was considering deferring all echoing/formatting to the UIs, so they can use
TecoGtkLabel or teco_curses_format_str().
This is not possible since messages transmitted via GError must not contain null-bytes,
so these need to be sorted out earlier anyway.
* This should also fix syntax errors in PDCurses for Windows where "%C" apparently doesn't
work with non-ANSI codepoints.
-rw-r--r-- | src/error.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/error.h b/src/error.h index 03af66c..0db6caa 100644 --- a/src/error.h +++ b/src/error.h @@ -64,8 +64,10 @@ typedef enum { static inline void teco_error_syntax_set(GError **error, gunichar chr) { + gchar buf[6]; + g_autofree gchar *chr_printable = teco_string_echo(buf, g_unichar_to_utf8(chr, buf)); g_set_error(error, TECO_ERROR, TECO_ERROR_SYNTAX, - "Syntax error \"%C\" (U+%04" G_GINT32_MODIFIER "X)", chr, chr); + "Syntax error \"%s\" (U+%04" G_GINT32_MODIFIER "X)", chr_printable, chr); } static inline void |