aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-26 16:27:27 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-26 16:27:27 +0000
commitcd6ce264f2345b0aaacef236af1751e5f9831cc9 (patch)
tree0bec5e3f37e8d30cdabbf232a776117e54d3557e /vim-mode/vim_mode.pl
parentvim_mode: Add W B E. (diff)
downloadirssi-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 '')
-rw-r--r--vim-mode/vim_mode.pl4
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;