diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-09-27 20:11:40 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-09-27 20:11:40 +0000 |
commit | 7ca688cc824072ee6ec8dfc1fc486270bc54db4b (patch) | |
tree | 97df44989e9d3b3b95967af3d0a3479894f6d9de | |
parent | bugfix, accidental duplication of 'send command' in emits in commit_line (diff) | |
download | irssi-scripts-7ca688cc824072ee6ec8dfc1fc486270bc54db4b.tar.gz irssi-scripts-7ca688cc824072ee6ec8dfc1fc486270bc54db4b.zip |
vim_mode: Fix e at end of the line and b at beginning of line with leading space.
-rw-r--r-- | vim-mode/vim_mode.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index dfc9bb2..40088fe 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -450,7 +450,9 @@ sub cmd_movement_b { $pos = 0 if ($pos < 0); $pos = _end_of_word($input, $count, $pos); - _input_pos(length($input) - $pos - 1); + $pos = length($input) - $pos - 1; + $pos = 0 if ($pos < 0); + _input_pos($pos); } sub cmd_movement_e { my ($count, $pos) = @_; @@ -462,7 +464,7 @@ sub cmd_movement_e { sub _end_of_word { my ($input, $count, $pos) = @_; - while ($count-- > 0) { + while ($count-- > 0 and length($input) > $pos) { my $skipped = 0; # Skip over whitespace if in the middle of it or directly after the # current word/non-word. |