From 913a7796bb47e0b65c4f28920c39a87c6b6211dd Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 13 May 2015 00:22:26 -0500 Subject: More hexedit cursor boundary tweaking. --- toys/other/hexedit.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/toys/other/hexedit.c b/toys/other/hexedit.c index 518755bb..9e9ca11e 100644 --- a/toys/other/hexedit.c +++ b/toys/other/hexedit.c @@ -75,18 +75,17 @@ static void draw_char(char broiled) static void draw_line(long long yy) { - int x; + int x, xx = 16; yy = (TT.base+yy)*16; + if (yy+xx>=TT.len) xx = TT.len-yy; if (yy=TT.len) { pos = TT.len-1; - x = (TT.len-1)%15; + x = pos&15; + y = (pos/16)-TT.base; } // Display cursor @@ -212,14 +212,14 @@ void hexedit_main(void) y = 0; } } else if (key==KEY_DOWN) { - if (y == TT.height-1 && pos+32=TT.height) y--; + if (++y>=TT.height) y--; } else if (key==KEY_RIGHT) { if (x<15 && pos+1