diff options
author | Rob Landley <rob@landley.net> | 2016-01-17 14:08:10 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-01-17 14:08:10 -0600 |
commit | 544c1ec1614cd9a8dcedac3478701e4b97b0f8a0 (patch) | |
tree | b2f0672f0f10be0de36d6a52d51fc78d215413dc /toys | |
parent | 5493916370c74944cc796cc91d058fb4ccabe140 (diff) | |
download | toybox-544c1ec1614cd9a8dcedac3478701e4b97b0f8a0.tar.gz |
Update draw_str() and friends to do standard escaping for ^X <AB> U+ABCD.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/other/hexedit.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/other/hexedit.c b/toys/other/hexedit.c index c86d75e8..b2e32c0e 100644 --- a/toys/other/hexedit.c +++ b/toys/other/hexedit.c @@ -56,7 +56,7 @@ static void draw_tail(void) tty_jump(0, TT.height); tty_esc("K"); - draw_rstr(*toys.optargs, 71, draw_char); + draw_rstr(*toys.optargs, 71); } static void draw_line(long long yy) @@ -127,7 +127,7 @@ void hexedit_main(void) fflush(0); xset_terminal(1, 1, 0); - if ((TT.len = fdlength(fd))<0) error_exit("bad length"); + if ((TT.len = fdlength(fd))<1) error_exit("bad length"); if (sizeof(long)==32 && TT.len>SIZE_MAX) TT.len = SIZE_MAX; // count file length hex in digits, rounded up to multiple of 4 for (pos = TT.len, TT.numlen = 0; pos; pos >>= 4, TT.numlen++); @@ -139,7 +139,7 @@ void hexedit_main(void) for (;;) { // Scroll display if necessary if (pos<0) pos = 0; - if (pos>TT.len) pos = TT.len-1; + if (pos>=TT.len) pos = TT.len-1; x = pos&15; y = pos/16; @@ -214,7 +214,7 @@ void hexedit_main(void) TT.data[pos] = toybuf[sizeof(long long)*UNDO_LEN+TT.undo]; } } - if (key>256) { + if (key>=256) { key -= 256; if (key==KEY_UP) pos -= 16; |