aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r--vim-mode/vim_mode.pl12
1 files changed, 11 insertions, 1 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index a0afc6c..0e665e6 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -1671,6 +1671,16 @@ sub handle_command_cmd {
my $cur_pos = _input_pos();
+ # Update input position of last undo entry so that undo/redo
+ # restores correct position.
+ if (@undo_buffer and _input() eq $undo_buffer[0]->[0] and
+ (defined $operator or exists $movements_repeatable->{$char} or
+ $char eq '.')) {
+ print "Updating history position: $undo_buffer[0]->[0]"
+ if DEBUG;
+ $undo_buffer[0]->[1] = $cur_pos;
+ }
+
# If defined $cur_pos will be changed to this.
my $old_pos;
# Position after the move.
@@ -1725,7 +1735,7 @@ sub handle_command_cmd {
# TODO: why do histpry entries still show up in undo
# buffer? Is avoiding the commands here insufficient?
- _add_undo_entry(_input(), $cur_pos);
+ _add_undo_entry(_input(), _input_pos());
}
# Store command, necessary for .