aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-26 20:33:16 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-26 20:33:39 +0000
commit650423db0c2535b401fbccbf564bcbd36ba29164 (patch)
tree2f0f5ad1af0cc1799ea3a20e89e379578d0452f3 /vim-mode/vim_mode.pl
parentanother todo comment (diff)
downloadirssi-scripts-650423db0c2535b401fbccbf564bcbd36ba29164.tar.gz
irssi-scripts-650423db0c2535b401fbccbf564bcbd36ba29164.zip
vim_mode: Prepare for skipping of movements.
No real changes, only if (1) {} and indentation.
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r--vim-mode/vim_mode.pl55
1 files changed, 29 insertions, 26 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 4dfffb1..141c836 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -702,34 +702,37 @@ sub handle_command {
$movement = $last->{movement};
}
- $numeric_prefix = 1 if not $numeric_prefix;
+ if (1) {
+ $numeric_prefix = 1 if not $numeric_prefix;
+
+ # Execute the movement (multiple times).
+ my $cur_pos = _input_pos();
+ if (not $movement) {
+ $movements->{$char}->{func}->($numeric_prefix, $cur_pos);
+ } else {
+ # Use the real movement command (like t or f) for operator
+ # below.
+ $char = substr $movement, 0, 1;
+ $movements->{$char}->{func}
+ ->($numeric_prefix, $cur_pos, substr $movement, 1);
+ }
+ my $new_pos = _input_pos();
+
+ # If we have an operator pending then run it on the handled
+ # text. 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);
+ }
- # Execute the movement (multiple times).
- my $cur_pos = _input_pos();
- if (not $movement) {
- $movements->{$char}->{func}->($numeric_prefix, $cur_pos);
- } else {
- # Use the real movement command (like t or f) for operator
- # below.
- $char = substr $movement, 0, 1;
- $movements->{$char}->{func}
- ->($numeric_prefix, $cur_pos, substr $movement, 1);
+ # Store command, necessary for .
+ $last->{char} = $char;
+ $last->{numeric_prefix} = $numeric_prefix;
+ $last->{operator} = $operator;
+ $last->{movement} = $movement;
}
- my $new_pos = _input_pos();
-
- # If we have an operator pending then run it on the handled text.
- # 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);
- }
-
- # Store command, necessary for .
- $last->{char} = $char;
- $last->{numeric_prefix} = $numeric_prefix;
- $last->{operator} = $operator;
- $last->{movement} = $movement;
$numeric_prefix = undef;
$operator = undef;