mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Improve input mechanism in hex mode
Print the 2 character hex code that you input in hex mode but then delete it before sending. This way it is easier to keep track of what you are inputting. It basically mimics the ctrl-shift-u input mechanism that is used to input unicode.
This commit is contained in:
parent
0b61aaf451
commit
5f14924c96
1 changed files with 6 additions and 0 deletions
|
|
@ -259,8 +259,14 @@ static void output_hex(char c)
|
||||||
{
|
{
|
||||||
hex_chars[hex_char_index++] = c;
|
hex_chars[hex_char_index++] = c;
|
||||||
|
|
||||||
|
printf("%c", c);
|
||||||
|
|
||||||
if (hex_char_index == 2)
|
if (hex_char_index == 2)
|
||||||
{
|
{
|
||||||
|
usleep(100*1000);
|
||||||
|
printf("\b \b");
|
||||||
|
printf("\b \b");
|
||||||
|
|
||||||
unsigned char hex_value = char_to_nibble(hex_chars[0]) << 4 | (char_to_nibble(hex_chars[1]) & 0x0F);
|
unsigned char hex_value = char_to_nibble(hex_chars[0]) << 4 | (char_to_nibble(hex_chars[1]) & 0x0F);
|
||||||
hex_char_index = 0;
|
hex_char_index = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue