diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-08-28 12:59:05 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-09-09 18:16:07 +0200 |
commit | 4c6b6814abfc9c022c6ea8d1e23097c2a774fde5 (patch) | |
tree | 26ea9ad6d2777c080c1733b55fc7d30180c335f5 /src/interface-curses/interface.c | |
parent | fdc185b8faaae44d67f85d2c5a9b9fa48d3e2859 (diff) | |
download | sciteco-4c6b6814abfc9c022c6ea8d1e23097c2a774fde5.tar.gz |
input and displaying of Unicode characters is now possible (refs #5)
* All non-ASCII characters are inserted as Unicode.
On Curses, this also requires a properly set up locale.
* We still do not need any widechar Curses, as waddch() handles
multibyte characters on ncurses.
We will see whether there is any Curses variant that strictly requires
wadd_wch().
If this will be an exception, we might keep both widechar and non-widechar
support.
* By convention gsize is used exclusively for byte sizes.
Character offsets or lengths use int or long.
Diffstat (limited to 'src/interface-curses/interface.c')
-rw-r--r-- | src/interface-curses/interface.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 8de744f..89be588 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -344,7 +344,7 @@ static struct { WINDOW *msg_window; WINDOW *cmdline_window, *cmdline_pad; - gsize cmdline_len, cmdline_rubout_len; + guint cmdline_len, cmdline_rubout_len; GQueue *input_queue; @@ -680,7 +680,7 @@ teco_interface_init_interactive(GError **error) #endif /* for displaying UTF-8 characters properly */ - setlocale(LC_CTYPE, ""); + setlocale(LC_ALL, ""); teco_interface_init_screen(); @@ -1044,7 +1044,8 @@ teco_interface_cmdline_update(const teco_cmdline_t *cmdline) * We don't know if it is similar to the last one, * so resizing makes no sense. * We approximate the size of the new formatted command-line, - * wasting a few bytes for control characters. + * wasting a few bytes for control characters and + * multi-byte Unicode sequences. */ if (teco_interface.cmdline_pad) delwin(teco_interface.cmdline_pad); @@ -1626,6 +1627,7 @@ teco_interface_event_loop_iter(void) /* * Function key macros + * FIXME: What about keyname()? */ #define FN(KEY) \ case KEY_##KEY: \ @@ -1660,7 +1662,7 @@ teco_interface_event_loop_iter(void) * Control keys and keys with printable representation */ default: - if (key < 0x80 && + if (key <= 0xFF && !teco_cmdline_keypress_c(key, &teco_interface.event_loop_error)) return; } |