aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-26 20:28:12 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-26 20:28:12 +0000
commit5530ebfaae5cc2df03b128c34125f24fdf57b738 (patch)
tree56ee0f7282ef8e9d2a57971fc064910072791bb8 /vim-mode/vim_mode.pl
parentvim_mode: Add <space>. (diff)
downloadirssi-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.pl11
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) {