diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-09-26 20:28:12 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-09-26 20:28:12 +0000 |
commit | 5530ebfaae5cc2df03b128c34125f24fdf57b738 (patch) | |
tree | 56ee0f7282ef8e9d2a57971fc064910072791bb8 /vim-mode/vim_mode.pl | |
parent | vim_mode: Add <space>. (diff) | |
download | irssi-scripts-5530ebfaae5cc2df03b128c34125f24fdf57b738.tar.gz irssi-scripts-5530ebfaae5cc2df03b128c34125f24fdf57b738.zip |
vim_mode: Fix j,k destroying current input line.
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r-- | vim-mode/vim_mode.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 8732d8b..a07e52e 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -113,6 +113,10 @@ my $registers # index into the history list (for j,k) my $history_index = undef; +# current line, necessary for j,k or the current input line gets destroyed +my $history_input = undef; +# position in input line +my $history_pos = 0; sub script_is_loaded { my $name = shift; @@ -283,8 +287,9 @@ sub cmd_movement_j { } if ($history_index > $#history) { - _input(''); - _input_pos(0); + # Restore the input line. + _input($history_input); + _input_pos($history_pos); $history_index = $#history + 1; } elsif ($history_index >= 0) { _input($history[$history_index]); @@ -308,6 +313,8 @@ sub cmd_movement_k { $history_index = 0 if $history_index < 0; } else { $history_index = $#history; + $history_input = _input(); + $history_pos = _input_pos(); } print "History Index: $history_index" if DEBUG; if ($history_index >= 0) { |