tweaks: improve a comment, rename a function, and elide a parameter
Checking the current menu instead of the current subwindow works fine.master
parent
2e4d78a714
commit
b3d6c27502
19
src/winio.c
19
src/winio.c
|
@ -1366,19 +1366,16 @@ long add_unicode_digit(int kbinput, long factor, long *uni)
|
||||||
return ERR;
|
return ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate a Unicode sequence: turn a six-digit hexadecimal number
|
/* For each consecutive call, gather the given digit into a six-digit Unicode
|
||||||
* (from 000000 to 10FFFF, case-insensitive) into its corresponding
|
* (from 000000 to 10FFFF, case-insensitive). When it is complete, return the
|
||||||
* multibyte value. */
|
* assembled Unicode; until then, return ERR when the given digit is valid. */
|
||||||
long get_unicode_kbinput(WINDOW *win, int kbinput)
|
long assemble_unicode(int kbinput)
|
||||||
{
|
{
|
||||||
static int uni_digits = 0;
|
static int uni_digits = 0;
|
||||||
static long uni = 0;
|
static long uni = 0;
|
||||||
long retval = ERR;
|
long retval = ERR;
|
||||||
|
|
||||||
/* Increment the Unicode digit counter. */
|
switch (++uni_digits) {
|
||||||
uni_digits++;
|
|
||||||
|
|
||||||
switch (uni_digits) {
|
|
||||||
case 1:
|
case 1:
|
||||||
/* The first digit must be zero or one. Put it in the
|
/* The first digit must be zero or one. Put it in the
|
||||||
* 0x100000's position of the Unicode sequence holder.
|
* 0x100000's position of the Unicode sequence holder.
|
||||||
|
@ -1416,7 +1413,7 @@ long get_unicode_kbinput(WINDOW *win, int kbinput)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show feedback only when editing, not when at a prompt. */
|
/* Show feedback only when editing, not when at a prompt. */
|
||||||
if (retval == ERR && win == edit) {
|
if (retval == ERR && currmenu == MMAIN) {
|
||||||
char partial[7] = "......";
|
char partial[7] = "......";
|
||||||
|
|
||||||
/* Construct the partial result, right-padding it with dots. */
|
/* Construct the partial result, right-padding it with dots. */
|
||||||
|
@ -1491,7 +1488,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (using_utf8()) {
|
if (using_utf8()) {
|
||||||
/* Check whether the first code is a valid starter digit: 0 or 1. */
|
/* Check whether the first code is a valid starter digit: 0 or 1. */
|
||||||
long unicode = get_unicode_kbinput(win, *kbinput);
|
long unicode = assemble_unicode(*kbinput);
|
||||||
|
|
||||||
/* If the first code isn't the digit 0 nor 1, put it back. */
|
/* If the first code isn't the digit 0 nor 1, put it back. */
|
||||||
if (unicode != ERR)
|
if (unicode != ERR)
|
||||||
|
@ -1508,7 +1505,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
free(kbinput);
|
free(kbinput);
|
||||||
while ((kbinput = get_input(win, 1)) == NULL)
|
while ((kbinput = get_input(win, 1)) == NULL)
|
||||||
;
|
;
|
||||||
unicode = get_unicode_kbinput(win, *kbinput);
|
unicode = assemble_unicode(*kbinput);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the Unicode value to a multibyte sequence. */
|
/* Convert the Unicode value to a multibyte sequence. */
|
||||||
|
|
Loading…
Reference in New Issue