diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-09-26 16:27:27 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-09-26 16:27:27 +0000 |
commit | cd6ce264f2345b0aaacef236af1751e5f9831cc9 (patch) | |
tree | 0bec5e3f37e8d30cdabbf232a776117e54d3557e /vim-mode | |
parent | vim_mode: Add W B E. (diff) | |
download | irssi-scripts-cd6ce264f2345b0aaacef236af1751e5f9831cc9.tar.gz irssi-scripts-cd6ce264f2345b0aaacef236af1751e5f9831cc9.zip |
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.
Diffstat (limited to 'vim-mode')
-rw-r--r-- | vim-mode/vim_mode.pl | 4 |
1 files changed, 3 insertions, 1 deletions
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; |