From d18335c2da11179af55c9c1e7f6420815e4b3d62 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 14 Oct 2010 22:48:02 +0200 Subject: vim_mode: Also remove 'setup changed' signal in UNLOAD. --- vim-mode/vim_mode.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 6ff8c78..a4c4ede 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2586,9 +2586,9 @@ sub setup_changed { sub UNLOAD { Irssi::signal_remove('gui key pressed' => \&got_key); + Irssi::signal_remove('setup changed' => \&setup_changed); Irssi::statusbar_item_unregister ('vim_mode'); Irssi::statusbar_item_unregister ('vim_windows'); - } sub _add_undo_entry { -- cgit v1.2.3 From 62e5d2a682f7185979e72d33c8396fb015bdfef2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 14 Oct 2010 22:54:43 +0200 Subject: vim_mode: Add THANKS section. --- vim-mode/vim_mode.pl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index a4c4ede..e754815 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -193,6 +193,11 @@ # WONTFIX - things we're not ever likely to do # * Macros # +# THANKS: +# +# * estragib: a lot of testing and many bug reports and feature requests +# * iaj: testing +# # LICENCE: # # Copyright (c) 2010 Tom Feist & Simon Ruderich -- cgit v1.2.3 From f7608ee4a3972c4fe52fe6c94721edac69c9e6c9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 14 Oct 2010 23:33:41 +0200 Subject: vim_mode: Automatically register and sync options. --- vim-mode/vim_mode.pl | 74 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 10 deletions(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index e754815..4baad78 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2538,10 +2538,10 @@ sub vim_mode_init { Irssi::statusbar_item_register ('vim_mode', 0, 'vim_mode_cb'); Irssi::statusbar_item_register ('vim_windows', 0, 'b_windows_cb'); - Irssi::settings_add_str('vim_mode', 'vim_mode_cmd_seq', ''); - Irssi::settings_add_bool('vim_mode', 'vim_mode_debug', 0); - Irssi::settings_add_bool('vim_mode', 'vim_mode_utf8', 1); - Irssi::settings_add_int('vim_mode', 'vim_mode_max_undo_lines', 50); + # Register all available settings. + foreach my $name (keys %$settings) { + _setting_register($name); + } # Load the vim_moderc file if it exists. ex_source('source'); @@ -2556,7 +2556,7 @@ sub setup_changed { if ($settings->{cmd_seq}->{value} ne '') { delete $imaps->{$settings->{cmd_seq}->{value}}; } - $value = Irssi::settings_get_str('vim_mode_cmd_seq'); + $value = _setting_get('cmd_seq'); if ($value eq '') { $settings->{cmd_seq}->{value} = $value; } else { @@ -2570,9 +2570,7 @@ sub setup_changed { } } - $settings->{debug}->{value} = Irssi::settings_get_bool('vim_mode_debug'); - - my $new_utf8 = Irssi::settings_get_bool('vim_mode_utf8'); + my $new_utf8 = _setting_get('utf8'); if ($new_utf8 != $settings->{utf8}->{value}) { # recompile the patterns when switching to/from utf-8 $word = qr/[\w_]/o; @@ -2585,8 +2583,13 @@ sub setup_changed { "Please disable the vim_mode_utf8 setting."); } - $settings->{max_undo_lines}->{value} - = Irssi::settings_get_int('vim_mode_max_undo_lines'); + # Sync $settings with current irssi values. + foreach my $name (keys %$settings) { + # These were already handled above. + next if $name eq 'cmd_seq' or $name eq 'cmd_seq'; + + $settings->{$name}->{value} = _setting_get($name); + } } sub UNLOAD { @@ -2863,6 +2866,57 @@ sub _set_prompt { Irssi::signal_emit('change prompt', $msg, 'UP_INNER'); } +sub _setting_get { + my ($name) = @_; + + my $type = $settings->{$name}->{type}; + $name = "vim_mode_$name"; + + if ($type == S_BOOL) { + return Irssi::settings_get_bool($name); + } elsif ($type == S_INT) { + return Irssi::settings_get_int($name); + } elsif ($type == S_STR) { + return Irssi::settings_get_str($name); + } else { + _warn("Unknown setting type '$type', please report."); + } + return undef; +} +sub _setting_set { + my ($name, $value) = @_; + + my $type = $settings->{$name}->{type}; + $name = "vim_mode_$name"; + + if ($type == S_BOOL) { + Irssi::settings_set_bool($name, $value); + } elsif ($type == S_INT) { + Irssi::settings_set_int($name, $value); + } elsif ($type == S_STR) { + Irssi::settings_set_str($name, $value); + } else { + _warn("Unknown setting type '$type', please report."); + } +} +sub _setting_register { + my ($name) = @_; + + my $value = $settings->{$name}->{value}; + my $type = $settings->{$name}->{type}; + $name = "vim_mode_$name"; + + if ($type == S_BOOL) { + Irssi::settings_add_bool('vim_mode', $name, $value); + } elsif ($type == S_INT) { + Irssi::settings_add_int('vim_mode', $name, $value); + } elsif ($type == S_STR) { + Irssi::settings_add_str('vim_mode', $name, $value); + } else { + _warn("Unknown setting type '$type', please report."); + } +} + sub _warn { my ($warning) = @_; -- cgit v1.2.3 From 6317b9b0c63042d096a139d79e6a83e3b6e15ba4 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 14 Oct 2010 23:34:39 +0200 Subject: vim_mode: Prevent invalid irssi options. --- vim-mode/vim_mode.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 4baad78..08c5174 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2567,6 +2567,9 @@ sub setup_changed { $settings->{cmd_seq}->{value} = $value; } else { _warn("Error: vim_mode_cmd_seq must be a single character"); + # Restore the value so $settings and irssi settings are + # consistent. + _setting_set('cmd_seq', $settings->{cmd_seq}->{value}); } } -- cgit v1.2.3 From b58172a9b8459daf53205149cedc6a607de4f724 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 14 Oct 2010 23:34:58 +0200 Subject: vim_mode: Case insensitive on/off checking in :set. --- vim-mode/vim_mode.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 08c5174..8956397 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1917,7 +1917,7 @@ sub ex_set { my $value = $2; # Also accept numeric values for boolean options. if ($settings->{$name}->{type} == S_BOOL and - $value !~ /^(on|off)$/) { + $value !~ /^(on|off)$/i) { $value = $value ? 'on' : 'off'; } Irssi::command("set vim_mode_$name $value"); -- cgit v1.2.3 From a45830b998af9340f7b52e91f2daf4f5006352ad Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 14 Oct 2010 23:36:46 +0200 Subject: vim_mode: Add 'start_cmd' option. --- vim-mode/vim_mode.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 8956397..e119d8f 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -114,6 +114,7 @@ # * utf8: support UTF-8 characters, boolean, default on # * debug: enable debug output, boolean, default off # * cmd_seq: char that when double-pressed simulates , string, default '' +# * start_cmd: start every line in command mode, boolean, default off # # In contrast to irssi's settings, :set accepts 0 and 1 as values for boolean # settings, but only vim_mode's settings can be set/displayed. @@ -488,6 +489,8 @@ my $settings utf8 => { type => S_BOOL, value => 1 }, # esc-shortcut in insert mode cmd_seq => { type => S_STR, value => '' }, + # start every line in command mode + start_cmd => { type => S_BOOL, value => 0 }, # not used yet max_undo_lines => { type => S_INT, value => 50 }, }; @@ -2744,6 +2747,9 @@ sub delete_map { sub _commit_line { _update_mode(M_INS); _reset_undo_buffer('', 0); + # separate from call above as _update_mode() does additional internal work + # and we need to make sure it gets correctly called. + _update_mode(M_CMD) if $settings->{start_cmd}->{value}; } sub _input { -- cgit v1.2.3 From 83808e44f8fb69c233fc192a7efe0d626e720b5c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 00:39:53 +0200 Subject: vim_mode: Make :set more vim-like, :set option=value. --- vim-mode/vim_mode.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index e119d8f..f90364e 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -118,6 +118,11 @@ # # In contrast to irssi's settings, :set accepts 0 and 1 as values for boolean # settings, but only vim_mode's settings can be set/displayed. +# Examples: +# :set cmd_seq=j # set cmd_seq to j +# :set cmd_seq= # disable cmd_seq +# :set debug=on # enable debug +# :set debug=off # disable debug # # # The following statusbar items are available: @@ -1910,7 +1915,7 @@ sub ex_set { my ($arg_str, $count) = @_; # :se[t] [option] [value] - if ($arg_str =~ /^se(?:t)?(?:\s(\S+)(?:\s(.+)$)?)?/) { + if ($arg_str =~ /^se(?:t)?(?:\s([^=]+)(?:=(.*)$)?)?/) { # :se[t] {option} {value} if (defined $1 and defined $2) { if (not exists $settings->{$1}) { -- cgit v1.2.3 From 920c082078387dedf40207a211f78a9d29725718 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 00:47:41 +0200 Subject: vim_mode: Fix :setting empty values. --- vim-mode/vim_mode.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f90364e..ce9405d 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1928,7 +1928,8 @@ sub ex_set { $value !~ /^(on|off)$/i) { $value = $value ? 'on' : 'off'; } - Irssi::command("set vim_mode_$name $value"); + _setting_set($name, $value); + Irssi::signal_emit('setup changed'); # :se[t] [option] } else { -- cgit v1.2.3 From 3322a447894b7c5fee6f30ea725fda2f79158594 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 01:58:32 +0200 Subject: vim_mode: Fix :set for boolean values. --- vim-mode/vim_mode.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index ce9405d..1f7fb14 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1924,9 +1924,12 @@ sub ex_set { my $name = $1; my $value = $2; # Also accept numeric values for boolean options. - if ($settings->{$name}->{type} == S_BOOL and - $value !~ /^(on|off)$/i) { - $value = $value ? 'on' : 'off'; + if ($settings->{$name}->{type} == S_BOOL) { + if ($value =~ /^(on|off)$/i) { + $value = lc $value eq 'on' ? 1 : 0; + } elsif ($value eq '') { + $value = 0; + } } _setting_set($name, $value); Irssi::signal_emit('setup changed'); -- cgit v1.2.3 From f22d37263ee0aec3f4190440403a49682631aab6 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 02:00:52 +0200 Subject: vim_mode: Don't emit 'setup changed' signal. Instead call our setup_changed() directly, not sure why the signal doesn't work. --- vim-mode/vim_mode.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 1f7fb14..9a6e5bc 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1932,7 +1932,7 @@ sub ex_set { } } _setting_set($name, $value); - Irssi::signal_emit('setup changed'); + setup_changed(); # :se[t] [option] } else { -- cgit v1.2.3 From dad93fef8bb1a02b8c9a5f91c9d12574bab4ff7a Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 20:37:34 +0200 Subject: vim_mode: Clear count when an unknown mapping is encountered. --- vim-mode/vim_mode.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 9a6e5bc..9be7ed9 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2291,6 +2291,7 @@ sub handle_command_cmd { } else { print "No mapping found for $char" if DEBUG; $pending_map = undef; + $numeric_prefix = undef; return 1; # call _stop() } -- cgit v1.2.3 From 11e71fbcfec0bcb2754cbd92b18ceffb27ee9300 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 20:46:49 +0200 Subject: vim_mode: Fix display of partial commands. Reported by estragib. --- vim-mode/vim_mode.pl | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 9be7ed9..6535a65 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 }, + no_operator => 1, dont_clear_partial_keys => 1 }, '.' => { char => '.', type => C_NORMAL, repeatable => 1, no_operator => 1 }, ':' => { char => ':', type => C_NORMAL }, @@ -527,6 +527,10 @@ 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 = { @@ -1472,6 +1476,8 @@ sub cmd_register { return (undef, undef); } + $partial_command .= $char; + # make sure black hole register is always empty if ($char eq '_') { $registers->{_} = ''; @@ -2025,21 +2031,8 @@ sub vim_mode_cb { $mode_str = '%_Ex%_'; } else { $mode_str = '%_Command%_'; - if ($register ne '"' or $numeric_prefix or $operator or $movement) { - $mode_str .= ' ('; - if ($register ne '"') { - $mode_str .= '"' . $register; - } - if ($numeric_prefix) { - $mode_str .= $numeric_prefix; - } - if ($operator) { - $mode_str .= $operator->{char}; - } - if ($movement) { - $mode_str .= $movement->{char}; - } - $mode_str .= ')'; + if ($partial_command) { + $mode_str .= " ($partial_command)"; } } $sb_item->default_handler($get_size_only, "{sb $mode_str}", '', 0); @@ -2255,6 +2248,7 @@ 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() } @@ -2273,6 +2267,8 @@ 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) { @@ -2292,6 +2288,7 @@ sub handle_command_cmd { print "No mapping found for $char" if DEBUG; $pending_map = undef; $numeric_prefix = undef; + $partial_command = ''; return 1; # call _stop() } @@ -2302,6 +2299,7 @@ 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,6 +2310,7 @@ 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) { @@ -2319,12 +2318,14 @@ sub handle_command_cmd { Irssi::command($cmd->{func}); $numeric_prefix = undef; + $partial_command = ''; return 1; # call _stop(); # does nothing. } elsif ($cmd->{type} == C_NOP) { print "Processing : $map->{char}" if DEBUG; $numeric_prefix = undef; + $partial_command = ''; return 1; # call _stop(); } @@ -2365,6 +2366,7 @@ sub handle_command_cmd { $numeric_prefix = undef; $operator = undef; $movement = undef; + $partial_command = ''; # Set new operator. } else { $operator = $cmd; @@ -2488,6 +2490,10 @@ 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 @@ -2851,9 +2857,13 @@ 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(''); + + $partial_command = ''; } $mode = $new_mode; -- cgit v1.2.3 From 30b23c218a163a14804b72bea87969411d36c563 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 20:55:31 +0200 Subject: vim_mode: Honor 'start_cmd' on startup. Reported by estragib. --- vim-mode/vim_mode.pl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 6535a65..48b7143 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2567,6 +2567,10 @@ sub vim_mode_init { setup_changed(); _reset_undo_buffer(); + + if ($settings->{start_cmd}) { + _update_mode(M_CMD); + } } sub setup_changed { -- cgit v1.2.3 From 3102e11d2948305f7104ead25cf5398f280903b9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 20:57:00 +0200 Subject: vim_mode: Aborting command also updates partial command. Reported by estragib. --- vim-mode/vim_mode.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 48b7143..5e23c02 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2866,8 +2866,6 @@ sub _update_mode { # Make sure prompt is cleared when leaving ex mode. } elsif ($mode == M_EX and $new_mode != M_EX) { _set_prompt(''); - - $partial_command = ''; } $mode = $new_mode; @@ -2884,6 +2882,7 @@ sub _update_mode { $register = '"'; $pending_map = undef; + $partial_command = ''; # Also clear ex-mode buffer. @ex_buf = (); -- cgit v1.2.3 From d75315db8ae93bedf02b2c78c640c061017052a2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 15 Oct 2010 21:00:26 +0200 Subject: vim_mode: Fix 'start_cmd' on startup/reload. --- vim-mode/vim_mode.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 5e23c02..03d214f 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2568,7 +2568,7 @@ sub vim_mode_init { setup_changed(); _reset_undo_buffer(); - if ($settings->{start_cmd}) { + if ($settings->{start_cmd}->{value}) { _update_mode(M_CMD); } } -- cgit v1.2.3 From 9d3443f57e763caf71429745d11d24c6bf48e59f Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 15 Oct 2010 20:37:45 +0100 Subject: vim_mode: resolved backslash display issue in vim status item --- vim-mode/vim_mode.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 03d214f..3cdae0b 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2032,7 +2032,9 @@ sub vim_mode_cb { } else { $mode_str = '%_Command%_'; if ($partial_command) { - $mode_str .= " ($partial_command)"; + my $p_copy = $partial_command; + $p_copy =~ s/\\/\\\\\\\\/g; + $mode_str .= " ($p_copy)"; } } $sb_item->default_handler($get_size_only, "{sb $mode_str}", '', 0); -- cgit v1.2.3 From e1a07cf133508b6cae049ded0b6b37b52e6fda47 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 15 Oct 2010 20:42:03 +0100 Subject: vim_mode: escaped % in _set_prompt so uberprompt displays them correctly. --- vim-mode/vim_mode.pl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 3cdae0b..cce0700 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2897,6 +2897,11 @@ sub _set_prompt { my $msg = shift; # add a leading space unless we're trying to clear it entirely. $msg = ' ' . $msg if length $msg; + + # escape % symbols. This prevents any _set_prompt calls from using + # colouring sequences. + $msg =~ s/%/%%/g; + Irssi::signal_emit('change prompt', $msg, 'UP_INNER'); } -- cgit v1.2.3