hexedit: position in correct column on "goto" command
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 14 Sep 2017 11:57:07 +0000 (13:57 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 14 Sep 2017 11:57:07 +0000 (13:57 +0200)
function                                             old     new   delta
hexedit_main                                        1169    1202     +33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/hexedit.c

index 1d683b7ded143f2be31d304751ae64d2e7f9edd5..7e74e1f248a9844e82a436cc93ebd4bd0d051f8e 100644 (file)
@@ -424,9 +424,11 @@ int hexedit_main(int argc UNUSED_PARAM, char **argv)
                                        if (t < 0)
                                                cnt = t = 0;
                                        G.offset = t;
-                                       remap(0);
+                                       remap(cnt & 0xf);
                                        redraw();
-                                       cnt /= 16;
+                                       if (cnt & 0xf)
+                                               printf(ESC"[%uC", (cnt & 0xf) * 3); /* cursor right 3*i */
+                                       cnt >>= 4;
                                        if (cnt)
                                                goto k_down;
                                        break;