aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-10-03 01:27:18 +0000
committerSimon Ruderich <simon@ruderich.org>2010-10-03 01:28:15 +0000
commit8949a4d0a231efd366fa272fad12c0ec9de882b2 (patch)
treec5cb5b04df7cfcee0fa8f58c5536abe4743f244e /vim-mode/vim_mode.pl
parentvim_mode: Hopefully fix undo/redo. (diff)
downloadirssi-scripts-8949a4d0a231efd366fa272fad12c0ec9de882b2.tar.gz
irssi-scripts-8949a4d0a231efd366fa272fad12c0ec9de882b2.zip
vim_mode: Hopefully fix undo positions.
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 .