diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-10-15 21:42:14 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-10-15 21:42:14 +0000 |
commit | 1810f78a87ce5c1c286dbab09281f804350a6685 (patch) | |
tree | f6b0082cafa8e345baf5616098df50667ca8f453 | |
parent | vim_mode: Partially revert 11e71fbcfec0bcb2754cbd92b18ceffb27ee9300 and fix p... (diff) | |
download | irssi-scripts-1810f78a87ce5c1c286dbab09281f804350a6685.tar.gz irssi-scripts-1810f78a87ce5c1c286dbab09281f804350a6685.zip |
vim_mode: Correctly display partial commands with ^X notation.
Reported by estragib.
-rw-r--r-- | vim-mode/vim_mode.pl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 871440e..6cbf617 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1865,6 +1865,16 @@ sub _parse_mapping_reverse { return $string; } +sub _parse_partial_command_reverse { + my ($string) = @_; + + # Convert Ctrl-X to ^X. + $string =~ s/([\x01-\x1A])/"^" . chr(ord($1) + 64)/ge; + # Convert Ctrl-6 and Ctrl-^ to <C-^>. + $string =~ s/\x1E/^^/g; + + return $string; +} sub ex_source { my ($arg_str, $count) = @_; @@ -2043,7 +2053,7 @@ sub vim_mode_cb { if (defined $pending_map) { $partial .= $pending_map; } - $partial = _parse_mapping_reverse($partial); + $partial = _parse_partial_command_reverse($partial); $partial =~ s/\\/\\\\\\\\/g; $mode_str .= " ($partial)"; } |