From 650423db0c2535b401fbccbf564bcbd36ba29164 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 26 Sep 2010 22:33:16 +0200 Subject: vim_mode: Prepare for skipping of movements. No real changes, only if (1) {} and indentation. --- vim-mode/vim_mode.pl | 55 +++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'vim-mode') 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; -- cgit v1.2.3