diff options
Diffstat (limited to 'vim-mode')
| -rw-r--r-- | vim-mode/vim_mode.pl | 49 | 
1 files changed, 22 insertions, 27 deletions
| diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f6af710..871440e 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -403,7 +403,7 @@ my $commands       '~'  => { char => '~', func => \&cmd_tilde, type => C_NORMAL,                 repeatable => 1, no_operator => 1 },       '"'  => { char => '"', func => \&cmd_register, type => C_NEEDSKEY, -               no_operator => 1, dont_clear_partial_keys => 1 }, +               no_operator => 1 },       '.'  => { char => '.', type => C_NORMAL, repeatable => 1,                 no_operator => 1 },       ':'  => { char => ':', type => C_NORMAL }, @@ -527,10 +527,6 @@ my $numeric_prefix = undef;  my $operator = undef;  # vi movements, only used when a movement needs more than one key (like f t).  my $movement = undef; - -# current partial command = all pending keys currently entered -my $partial_command = ''; -  # last vi command, used by .  my $last    = { @@ -1476,8 +1472,6 @@ sub cmd_register {          return (undef, undef);      } -    $partial_command .= $char; -      # make sure black hole register is always empty      if ($char eq '_') {          $registers->{_} = ''; @@ -2031,10 +2025,27 @@ sub vim_mode_cb {          $mode_str = '%_Ex%_';      } else {          $mode_str = '%_Command%_'; -        if ($partial_command) { -            my $p_copy = _parse_mapping_reverse($partial_command); -            $p_copy =~ s/\\/\\\\\\\\/g; -            $mode_str .= " ($p_copy)"; +        if ($register ne '"' or $numeric_prefix or $operator or $movement or +                                $pending_map) { +            my $partial = ''; +            if ($register ne '"') { +                $partial .= '"' . $register; +            } +            if ($numeric_prefix) { +                $partial .= $numeric_prefix; +            } +            if ($operator) { +                $partial .= $operator->{char}; +            } +            if ($movement) { +                $partial .= $movement->{char}; +            } +            if (defined $pending_map) { +                $partial .= $pending_map; +            } +            $partial = _parse_mapping_reverse($partial); +            $partial =~ s/\\/\\\\\\\\/g; +            $mode_str .= " ($partial)";          }      }      $sb_item->default_handler($get_size_only, "{sb $mode_str}", '', 0); @@ -2250,7 +2261,6 @@ sub handle_command_cmd {          ($char =~ m/[1-9]/ or ($numeric_prefix && $char =~ m/[0-9]/))) {          print "Processing numeric prefix: $char" if DEBUG;          handle_numeric_prefix($char); -        $partial_command .= $char;          return 1; # call _stop()      } @@ -2269,8 +2279,6 @@ sub handle_command_cmd {      } elsif (exists $maps->{$char}) {          $map = $maps->{$char}; -        $partial_command .= $char; -          # We have multiple mappings starting with this key sequence.          if (!$pending_map_flushed and scalar keys %{$map->{maps}} > 0) {              if (not defined $pending_map) { @@ -2290,7 +2298,6 @@ sub handle_command_cmd {          print "No mapping found for $char" if DEBUG;          $pending_map = undef;          $numeric_prefix = undef; -        $partial_command = '';          return 1; # call _stop()      } @@ -2301,7 +2308,6 @@ sub handle_command_cmd {      # Make sure we have a valid $cmd.      if (not defined $cmd) {          print "Bug in pending_map_flushed() $map->{char}" if DEBUG; -        $partial_command = '';          return 1; # call _stop()      } @@ -2312,7 +2318,6 @@ sub handle_command_cmd {          $cmd->{func}->(substr($cmd->{char}, 1), $numeric_prefix);          $numeric_prefix = undef; -        $partial_command = '';          return 1; # call _stop()      # As can irssi commands.      } elsif ($cmd->{type} == C_IRSSI) { @@ -2320,14 +2325,12 @@ sub handle_command_cmd {          Irssi::command($cmd->{func});          $numeric_prefix = undef; -        $partial_command = '';          return 1; # call _stop();      # <Nop> does nothing.      } elsif ($cmd->{type} == C_NOP) {          print "Processing <Nop>: $map->{char}" if DEBUG;          $numeric_prefix = undef; -        $partial_command = '';          return 1; # call _stop();      } @@ -2368,7 +2371,6 @@ sub handle_command_cmd {              $numeric_prefix = undef;              $operator = undef;              $movement = undef; -            $partial_command = '';          # Set new operator.          } else {              $operator = $cmd; @@ -2492,10 +2494,6 @@ sub handle_command_cmd {                  $last->{movement} = $movement;                  $last->{register} = $register;              } - -            if (!$cmd->{dont_clear_partial_keys}) { -                $partial_command = ''; -            }          }          # Reset the count unless we go into insert mode, _update_mode() needs @@ -2863,8 +2861,6 @@ sub _update_mode {      # It's necessary when pressing enter so the next line can be repeated.      } elsif ($mode == M_CMD and $new_mode == M_INS) {          $last->{cmd} = $commands->{i}; - -        $partial_command = '';      # Make sure prompt is cleared when leaving ex mode.      } elsif ($mode == M_EX and $new_mode != M_EX) {          _set_prompt(''); @@ -2884,7 +2880,6 @@ sub _update_mode {          $register = '"';          $pending_map = undef; -        $partial_command = '';          # Also clear ex-mode buffer.          @ex_buf = (); | 
