diff options
-rw-r--r-- | source/gui.c | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/source/gui.c b/source/gui.c index 62edefe..bf1feb5 100644 --- a/source/gui.c +++ b/source/gui.c @@ -936,7 +936,7 @@ int GUI_Input(const char *prompt, char text[], int maxlen) {SK_7, '7', 0}, {SK_8, '8', 0}, {SK_9, '9', 0}, - {SK_0, '0', 0}, + {SK_0, '0', 8}, {SK_A, 'A', 0}, {SK_B, 'B', '*'}, {SK_C, 'C', '?'}, @@ -1033,35 +1033,42 @@ int GUI_Input(const char *prompt, char text[], int maxlen) break; default: - if (l < maxlen) - { - f = 0; - ascii = 0; - - while(!ascii && keymap[f].ascii) - { - if (ev.key == keymap[f].key) - { - if (shifted) - { - ascii = keymap[f].shift; - } - else - { - ascii = keymap[f].ascii; - } - } - - f++; - } - - if (ascii) - { - text[l++] = ascii; - text[l] = 0; - } - } - break; + f = 0; + ascii = 0; + + while(!ascii && keymap[f].ascii) + { + if (ev.key == keymap[f].key) + { + if (shifted) + { + ascii = keymap[f].shift; + } + else + { + ascii = keymap[f].ascii; + } + } + + f++; + } + + if (ascii == 8) + { + if (l) + { + text[--l] = 0; + } + } + else if (ascii) + { + if (l < maxlen) + { + text[l++] = ascii; + text[l] = 0; + } + } + break; } } } |