Fix menu input handling in text UI - sacc - sacc(omys), simple console gopher client
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
Log
Files
Refs
Tags
LICENSE
---
commit 38704075332efd50523896ea0ae68275b7fe0a0f
parent f1216bbc6ea47edb1b8ca655ed7c2ebadaccce33
Author: Quentin Rameau 
Date:   Fri,  1 Sep 2017 15:24:47 +0200

Fix menu input handling in text UI

Also fix a typo introduced in 3eabb27

Diffstat:
  M ui_txt.c                            |       9 +++------

1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/ui_txt.c b/ui_txt.c
@@ -172,10 +172,10 @@ uiselectitem(Item *entry)
                 return NULL;
 
         nitems = dir ? dir->nitems : 0;
-        if (!c)
-                c = 'h';
 
         for (;;) {
+                if (!c)
+                        c = 'h';
                 printstatus(entry, c);
                 fflush(stdout);
 
@@ -244,10 +244,7 @@ uiselectitem(Item *entry)
                         continue;
                 }
 
-                if (*buf < '0' || *buf > '9')
-                        continue;
-
-                if (item > 0 && item <= nitems);
+                if (item >= 0 && item <= nitems)
                         break;
         }