zygo

ncurses gopher client
Log | Files | Refs

commit c0e09269093eeddc533cdbf16a2b2f30a72619bf
parent b2b04b47e00f0c9ea20fbb5e723cda97e33c30bc
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 29 Jan 2022 17:44:48 +0000

zygo.c: fix backspace bug with link ids

Diffstat:
Mzygo.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/zygo.c b/zygo.c @@ -995,6 +995,13 @@ run(void) { } else if (ui.wantinput == 2) { if (c == 27 /* escape */) { ui.wantinput = 0; + } else if (c == KEY_BACKSPACE || c == 127) { + if (il <= 1) { + ui.wantinput = 0; + } else { + ui.input[--il] = '\0'; + syncinput(); + } } else if (c == '\n' || il + 1 >= digits(page->lastid)) { if (c != '\n') { ui.input[il++] = c; @@ -1002,13 +1009,6 @@ run(void) { syncinput(); } goto gonum; - } else if (c == KEY_BACKSPACE || c == 127) { - if (il == 0) { - ui.wantinput = 0; - } else { - ui.input[--il] = '\0'; - syncinput(); - } } else if (isdigit((int)c)) { ui.input[il++] = c; ui.input[il] = '\0';