aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-10-15 21:42:14 +0000
committerSimon Ruderich <simon@ruderich.org>2010-10-15 21:42:14 +0000
commit1810f78a87ce5c1c286dbab09281f804350a6685 (patch)
treef6b0082cafa8e345baf5616098df50667ca8f453 /vim-mode
parentvim_mode: Partially revert 11e71fbcfec0bcb2754cbd92b18ceffb27ee9300 and fix p... (diff)
downloadirssi-scripts-1810f78a87ce5c1c286dbab09281f804350a6685.tar.gz
irssi-scripts-1810f78a87ce5c1c286dbab09281f804350a6685.zip
vim_mode: Correctly display partial commands with ^X notation.
Reported by estragib.
Diffstat (limited to '')
-rw-r--r--vim-mode/vim_mode.pl12
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)";
}