From ae73ff808df9356552f231934612412281dc45e9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 30 Sep 2010 00:27:36 +0200 Subject: vim_mode: Fix C not to move one character to the left. --- vim-mode/vim_mode.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index bd15c2f..f7705ed 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -324,7 +324,8 @@ sub cmd_operator_c { } } - cmd_operator_d($old_pos, $new_pos, $move, $repeat); + cmd_operator_d($old_pos, $new_pos, $move, $repeat, 1); + if (!$repeat) { _update_mode(M_INS); } else { @@ -332,7 +333,7 @@ sub cmd_operator_c { } } sub cmd_operator_d { - my ($old_pos, $new_pos, $move, $repeat) = @_; + my ($old_pos, $new_pos, $move, $repeat, $change) = @_; my ($pos, $length) = _get_pos_and_length($old_pos, $new_pos, $move); @@ -348,8 +349,9 @@ sub cmd_operator_d { } _input($input); - # Prevent moving after the text when we delete the last character. - $pos-- if $pos == length($input); + # Prevent moving after the text when we delete the last character. But not + # when changing (C). + $pos-- if $pos == length($input) and !$change; # Move the cursor at the right position. _input_pos($pos); -- cgit v1.2.3