diff --git a/src/proto.h b/src/proto.h index 6b938cb6427ec5d1e8b05d6a83313e6b8431d186..0d5bb34b59fd8aa9add85dff89d919fe3e750b39 100644 --- a/src/proto.h +++ b/src/proto.h @@ -775,7 +775,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput); int get_byte_kbinput(int kbinput); #ifdef ENABLE_UTF8 long add_unicode_digit(int kbinput, long factor, long *uni); -long get_unicode_kbinput(int kbinput); +long get_unicode_kbinput(WINDOW *win, int kbinput); #endif int get_control_kbinput(int kbinput); void unparse_kbinput(char *output, size_t output_len); diff --git a/src/winio.c b/src/winio.c index 1ae8a910252931745518a396e4f7b4e922252280..95848cc797178f9c3bb8b51c09254023f75af4ac 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1230,7 +1230,7 @@ long add_unicode_digit(int kbinput, long factor, long *uni) /* Translate a Unicode sequence: turn a six-digit hexadecimal number * (from 000000 to 10FFFF, case-insensitive) into its corresponding * multibyte value. */ -long get_unicode_kbinput(int kbinput) +long get_unicode_kbinput(WINDOW *win, int kbinput) { static int uni_digits = 0; static long uni = 0; @@ -1290,12 +1290,24 @@ long get_unicode_kbinput(int kbinput) break; } - /* If we have a result, reset the Unicode digit counter and the + /* If we have a full result, reset the Unicode digit counter and the * Unicode sequence holder. */ if (retval != ERR) { uni_digits = 0; uni = 0; } + /* Show feedback only when editing, not when at a prompt. */ + else if (win == edit) { + char partial[7] = "......"; + + /* Construct the partial result, right-padding it with dots. */ + snprintf(partial, uni_digits + 1, "%06lX", uni); + partial[uni_digits] = '.'; + + /* TRANSLATORS: This is shown while a six-digit hexadecimal + * Unicode character code (%s) is being typed in. */ + statusline(HUSH, _("Unicode Input: %s"), partial); + } #ifdef DEBUG fprintf(stderr, "get_unicode_kbinput(): kbinput = %d, uni_digits = %d, uni = %ld, retval = %ld\n", kbinput, uni_digits, uni, retval); @@ -1413,7 +1425,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len) if (using_utf8()) { /* Check whether the first keystroke is a valid hexadecimal * digit. */ - long uni = get_unicode_kbinput(*kbinput); + long uni = get_unicode_kbinput(win, *kbinput); /* If the first keystroke isn't a valid hexadecimal digit, put * back the first keystroke. */ @@ -1427,16 +1439,11 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len) char *uni_mb; int uni_mb_len, *seq, i; - if (win == edit) - /* TRANSLATORS: This is displayed during the input of a - * six-digit hexadecimal Unicode character code. */ - statusbar(_("Unicode Input")); - while (uni == ERR) { free(kbinput); while ((kbinput = get_input(win, 1)) == NULL) ; - uni = get_unicode_kbinput(*kbinput); + uni = get_unicode_kbinput(win, *kbinput); } /* Put back the multibyte equivalent of the Unicode