From 5a5ab2693ba20ccbd8897edc75755bbb337bc851 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 2 Apr 2018 22:41:12 +0200 Subject: [PATCH] Fix seek undo and make s.. push in the undo history --- libr/core/cmd_seek.c | 1 + libr/io/undo.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/libr/core/cmd_seek.c b/libr/core/cmd_seek.c index 8927575d7b..1b4728bb9e 100644 --- a/libr/core/cmd_seek.c +++ b/libr/core/cmd_seek.c @@ -402,6 +402,7 @@ static int cmd_seek(void *data, const char *input) { ; } r_core_seek_base (core, input); + r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print)); break; case 'j': // "sj" { diff --git a/libr/io/undo.c b/libr/io/undo.c index 5e5ef43908..3604d8c6f3 100644 --- a/libr/io/undo.c +++ b/libr/io/undo.c @@ -44,6 +44,10 @@ R_API RIOUndos *r_io_sundo(RIO *io, ut64 offset) { undo->cursor = 0; } + // hack to fix undo seek + if (io->undo.redos == 0) { + io->undo.idx--; + } io->undo.idx = (io->undo.idx - 1 + R_IO_UNDOS) % R_IO_UNDOS; io->undo.undos--; io->undo.redos++;