aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-29 16:16:15 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-29 16:16:15 +0000
commit889b2b262800c17f462c62ddea2a290788c42087 (patch)
treee0c5335d5256cedfe6da11132f4ee6eea1f74c90 /vim-mode
parentvim_mode: Add support to append to registers (A-Z). (diff)
downloadirssi-scripts-889b2b262800c17f462c62ddea2a290788c42087.tar.gz
irssi-scripts-889b2b262800c17f462c62ddea2a290788c42087.zip
vim_mode: Don't move after last character in command mode.
Diffstat (limited to 'vim-mode')
-rw-r--r--vim-mode/vim_mode.pl15
1 files changed, 11 insertions, 4 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 3cf1b7e..a42fc65 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -390,7 +390,7 @@ sub cmd_movement_l {
my $length = _input_len();
$pos += $count;
- $pos = $length if $pos > $length;
+ $pos = $length - 1 if $pos > $length - 1;
_input_pos($pos);
}
sub cmd_movement_space {
@@ -642,7 +642,7 @@ sub cmd_movement_caret {
_input_pos($pos);
}
sub cmd_movement_dollar {
- _input_pos(_input_len());
+ _input_pos(_input_len() - 1);
}
sub cmd_movement_x {
@@ -682,7 +682,13 @@ sub cmd_movement_I {
sub cmd_movement_a {
my ($count, $pos, $repeat) = @_;
- cmd_movement_l(1, _input_pos());
+ # Move after current character. Can't use cmd_movement_l() because we need
+ # to mover after last character at the end of the line.
+ my $length = _input_len();
+ $pos += $count;
+ $pos = $length if $pos > $length;
+ _input_pos($pos);
+
if (!$repeat) {
_update_mode(M_INS);
} else {
@@ -692,7 +698,8 @@ sub cmd_movement_a {
sub cmd_movement_A {
my ($count, $pos, $repeat) = @_;
- cmd_movement_dollar();
+ _input_pos(_input_len());
+
if (!$repeat) {
_update_mode(M_INS);
} else {