ui_ti: refactor DEC function key handling a bit for an upcoming commit - sacc - sacc(omys), simple console gopher client
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
Log
Files
Refs
Tags
LICENSE
---
commit b4f6ed2bf2344c5717523313bc666eb297a6fe36
parent 100d8ae55fc598a2c898bd6b5d33e15f131cee0c
Author: Hiltjo Posthuma 
Date:   Sun, 27 Mar 2022 13:28:02 +0200

ui_ti: refactor DEC function key handling a bit for an upcoming commit

No functional change intended.

Diffstat:
  M ui_ti.c                             |      20 +++++++++++---------

1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/ui_ti.c b/ui_ti.c
@@ -424,7 +424,7 @@ uiselectitem(Item *entry)
 {
         Dir *dir;
         char *searchstr = NULL;
-        int plines = lines-2;
+        int c, plines = lines-2;
 
         if (!entry || !(dir = entry->dat))
                 return NULL;
@@ -441,19 +441,21 @@ uiselectitem(Item *entry)
                         default:
                                 continue;
                         }
-                        switch (getchar()) {
+                        c = getchar();
+                        switch (c) {
                         case '4':
-                                if (getchar() != '~')
-                                        continue;
-                                goto end;
                         case '5':
-                                if (getchar() != '~')
-                                        continue;
-                                goto pgup;
                         case '6':
                                 if (getchar() != '~')
                                         continue;
-                                goto pgdown;
+                                switch (c) {
+                                case '4':
+                                        goto end;
+                                case '5':
+                                        goto pgup;
+                                case '6':
+                                        goto pgdown;
+                                }
                         case 'A':
                                 goto lnup;
                         case 'B':