diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-10-03 21:42:50 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-10-03 21:42:50 +0000 |
commit | cf9f774ef829bae12eb055e148cb04ec7799b1c0 (patch) | |
tree | 3ac5d639b2f6ebaea7a390d6d2a9d7ca2eec4cec | |
parent | vim_mode: Fix c repetition. (diff) | |
download | irssi-scripts-cf9f774ef829bae12eb055e148cb04ec7799b1c0.tar.gz irssi-scripts-cf9f774ef829bae12eb055e148cb04ec7799b1c0.zip |
vim_mode: Fix cw/cW on whitespace directly in front of word.
-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 ba736a5..588c1e1 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -394,10 +394,12 @@ sub cmd_insert_ctrl_r { sub cmd_operator_c { my ($old_pos, $new_pos, $move, $repeat) = @_; - # Changing a word or WORD doesn't delete the last space before a word. + # Changing a word or WORD doesn't delete the last space before a word, but + # not if we are on that whitespace before the word. if ($move eq 'w' or $move eq 'W') { my $input = _input(); - if (substr($input, $new_pos - 1, 1) =~ /\s/) { + if ($new_pos - $old_pos > 1 and + substr($input, $new_pos - 1, 1) =~ /\s/) { $new_pos--; } } |