aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-12-27 14:41:30 -0600
committerRob Landley <rob@landley.net>2015-12-27 14:41:30 -0600
commit4b4ab6a50998219cd94139c5669ef9a624c8f58f (patch)
tree3a1e0812da0cfc3c8f8040a381e763531c1026ba /toys/other
parent6769f8eb580aa2ecac4009fcde4a113e0476de74 (diff)
downloadtoybox-4b4ab6a50998219cd94139c5669ef9a624c8f58f.tar.gz
Add scan_key_getsize() doing the ANSI probe, switch scan_key() to TAGGED_ARRAY,
and add test_scankey.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/hexedit.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/toys/other/hexedit.c b/toys/other/hexedit.c
index 1c2ad88e..b3bde2e5 100644
--- a/toys/other/hexedit.c
+++ b/toys/other/hexedit.c
@@ -213,16 +213,21 @@ void hexedit_main(void)
pos = ll[--TT.undo];
TT.data[pos] = toybuf[sizeof(long long)*UNDO_LEN+TT.undo];
}
- } else if (key==KEY_UP) pos -= 16;
- else if (key==KEY_DOWN) pos += 16;
- else if (key==KEY_RIGHT) {
- if (x<15) pos++;
- } else if (key==KEY_LEFT) {
- if (x) pos--;
- } else if (key==KEY_PGUP) pos -= 16*TT.height;
- else if (key==KEY_PGDN) pos += 16*TT.height;
- else if (key==KEY_HOME) pos = 0;
- else if (key==KEY_END) pos = TT.len-1;
+ }
+ if (key>256) {
+ key -= 256;
+
+ if (key==KEY_UP) pos -= 16;
+ else if (key==KEY_DOWN) pos += 16;
+ else if (key==KEY_RIGHT) {
+ if (x<15) pos++;
+ } else if (key==KEY_LEFT) {
+ if (x) pos--;
+ } else if (key==KEY_PGUP) pos -= 16*TT.height;
+ else if (key==KEY_PGDN) pos += 16*TT.height;
+ else if (key==KEY_HOME) pos = 0;
+ else if (key==KEY_END) pos = TT.len-1;
+ }
}
munmap(TT.data, TT.len);
close(fd);