From 544c1ec1614cd9a8dcedac3478701e4b97b0f8a0 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 17 Jan 2016 14:08:10 -0600 Subject: Update draw_str() and friends to do standard escaping for ^X U+ABCD. --- toys/other/hexedit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'toys') 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; -- cgit v1.2.3