From e3e06d4e57388eac3f5ae78efd731095d0ba2dc3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 2 Oct 2010 17:44:00 +0200 Subject: vim_mode: Fix r with count. --- vim-mode/vim_mode.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 50792dd..d01c5dc 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -985,9 +985,13 @@ sub cmd_movement_r { my ($count, $pos, $repeat, $char) = @_; my $input = _input(); - substr $input, $pos, 1, $char; + + # Abort if at end of the line. + return (undef, undef) if length($input) < $pos + $count; + + substr $input, $pos, $count, $char x $count; _input($input); - return (undef, $pos); + return (undef, $pos + $count - 1); } sub cmd_movement_p { -- cgit v1.2.3