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++;