From cf9f774ef829bae12eb055e148cb04ec7799b1c0 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 3 Oct 2010 23:42:50 +0200 Subject: vim_mode: Fix cw/cW on whitespace directly in front of word. --- vim-mode/vim_mode.pl | 6 ++++-- 1 file 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--; } } -- cgit v1.2.3