From cd6ce264f2345b0aaacef236af1751e5f9831cc9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 26 Sep 2010 18:27:27 +0200 Subject: vim_mode: Don't run the operator if the position hasn't changed. This prevents problems with e.g. df when the searched character wasn't found. This used to delete one character. --- vim-mode/vim_mode.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index a0b5f1c..4d1abec 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -667,7 +667,9 @@ sub handle_command { my $new_pos = _input_pos(); # If we have an operator pending then run it on the handled text. - if ($operator) { + # But only if the movement changed the position (this prevents + # problems with e.g. f when the search string doesn't exist). + if ($operator and $cur_pos != $new_pos) { print "Processing operator: ", $operator if DEBUG; $operators->{$operator}->{func}->($cur_pos, $new_pos, $char); $operator = undef; -- cgit v1.2.3