mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-30 08:33:17 +03:00
tweaks: trim some comments, and simplify a condition
This commit is contained in:
parent
4416d9c941
commit
a472f480a7
34
src/winio.c
34
src/winio.c
@ -1241,50 +1241,36 @@ long get_unicode_kbinput(WINDOW *win, int kbinput)
|
|||||||
|
|
||||||
switch (uni_digits) {
|
switch (uni_digits) {
|
||||||
case 1:
|
case 1:
|
||||||
/* First digit: This 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.
|
||||||
if ('0' <= kbinput && kbinput <= '1')
|
* Otherwise, return the character itself as the result. */
|
||||||
|
if (kbinput == '0' || kbinput == '1')
|
||||||
uni = (kbinput - '0') * 0x100000;
|
uni = (kbinput - '0') * 0x100000;
|
||||||
else
|
else
|
||||||
/* This isn't the first digit of a Unicode sequence.
|
|
||||||
* Return this character as the result. */
|
|
||||||
retval = kbinput;
|
retval = kbinput;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
/* Second digit: This must be zero if the first was one, and
|
/* The second digit must be zero if the first was one, but
|
||||||
* may be any hexadecimal value if the first was zero. Put
|
* may be any hexadecimal value if the first was zero. */
|
||||||
* it in the 0x10000's position of the Unicode sequence
|
if (kbinput == '0' || uni == 0)
|
||||||
* holder. */
|
|
||||||
if (uni == 0 || '0' == kbinput)
|
|
||||||
retval = add_unicode_digit(kbinput, 0x10000, &uni);
|
retval = add_unicode_digit(kbinput, 0x10000, &uni);
|
||||||
else
|
else
|
||||||
/* This isn't the second digit of a Unicode sequence.
|
|
||||||
* Return this character as the result. */
|
|
||||||
retval = kbinput;
|
retval = kbinput;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
/* Third digit: This may be any hexadecimal value. Put it
|
/* Later digits may be any hexadecimal value. */
|
||||||
* in the 0x1000's position of the Unicode sequence
|
|
||||||
* holder. */
|
|
||||||
retval = add_unicode_digit(kbinput, 0x1000, &uni);
|
retval = add_unicode_digit(kbinput, 0x1000, &uni);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
/* Fourth digit: This may be any hexadecimal value. Put it
|
|
||||||
* in the 0x100's position of the Unicode sequence
|
|
||||||
* holder. */
|
|
||||||
retval = add_unicode_digit(kbinput, 0x100, &uni);
|
retval = add_unicode_digit(kbinput, 0x100, &uni);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
/* Fifth digit: This may be any hexadecimal value. Put it
|
|
||||||
* in the 0x10's position of the Unicode sequence holder. */
|
|
||||||
retval = add_unicode_digit(kbinput, 0x10, &uni);
|
retval = add_unicode_digit(kbinput, 0x10, &uni);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
/* Sixth digit: This may be any hexadecimal value. Put it
|
|
||||||
* in the 0x1's position of the Unicode sequence holder. */
|
|
||||||
retval = add_unicode_digit(kbinput, 0x1, &uni);
|
retval = add_unicode_digit(kbinput, 0x1, &uni);
|
||||||
/* If this character is a valid hexadecimal value, then the
|
/* If also the sixth digit was a valid hexadecimal value, then
|
||||||
* Unicode sequence is complete. */
|
* the Unicode sequence is complete, so return it. */
|
||||||
if (retval == ERR)
|
if (retval == ERR)
|
||||||
retval = uni;
|
retval = uni;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user