aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--prompt_info/uberprompt.pl12
-rw-r--r--vim-mode/vim_mode.pl36
2 files changed, 45 insertions, 3 deletions
diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl
index ded45cf..4d95b06 100644
--- a/prompt_info/uberprompt.pl
+++ b/prompt_info/uberprompt.pl
@@ -139,6 +139,10 @@ my $prompt_data_pos = 'UP_INNER';
my $prompt_last = '';
my $prompt_format = '';
+# flag to indicate whether rendering of hte prompt should allow the replaces
+# theme formats to be applied to the content.
+my $use_replaces = 0;
+
pre_init();
sub pre_init {
@@ -175,6 +179,8 @@ sub init {
Irssi::settings_add_str('uberprompt', 'uberprompt_format', '[$*$uber] ');
Irssi::settings_add_bool('uberprompt', 'uberprompt_debug', 0);
Irssi::settings_add_bool('uberprompt', 'uberprompt_autostart', 1);
+ Irssi::settings_add_bool('uberprompt', 'uberprompt_use_replaces', 0);
+
Irssi::command_bind("prompt", \&prompt_subcmd_handler);
Irssi::command_bind('prompt on', \&replace_prompt_items);
@@ -224,6 +230,8 @@ sub init {
sub reload_settings {
+ $use_replaces = Irssi::settings_get_bool('uberprompt_use_replaces');
+
$DEBUG_ENABLED = Irssi::settings_get_bool('uberprompt_debug');
my $new = Irssi::settings_get_str('uberprompt_format');
@@ -289,8 +297,8 @@ sub uberprompt_draw {
my $prompt = ''; # rendered content of the prompt.
my $theme = Irssi::current_theme;
- $prompt = $theme->format_expand
- ("{uberprompt $prompt_arg}", Irssi::EXPAND_FLAG_IGNORE_REPLACES);
+ my $arg = $use_replaces ? 0 : Irssi::EXPAND_FLAG_IGNORE_REPLACES;
+ $prompt = $theme->format_expand("{uberprompt $prompt_arg}", $arg);
if ($prompt_data_pos eq 'UP_ONLY') {
$prompt =~ s/\$\$uber//; # no need for recursive prompting, I hope.
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 2c7e744..d61db3d 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -1701,12 +1701,46 @@ sub ex_registers {
$registers->{'+'} = Irssi::parse_special('$U');
$registers->{'*'} = $registers->{'+'};
+ my @empty_regs;
+ my $special_regs = { '+' => 1, '*' => 1, '_' => 1, '"' => 1, '0' => 1 };
+
my $active_window = Irssi::active_win;
foreach my $key (sort @regs) {
next if $key eq '_'; # skip black hole
if (defined $registers->{$key}) {
- $active_window->print("register $key: $registers->{$key}");
+ my $register_val = $registers->{$key};
+ if (length $register_val or exists $special_regs->{$key}) {
+ $register_val =~ s/%/%%/g;
+ $active_window->print("register $key: $register_val");
+ } else {
+ push @empty_regs, $key;
+ }
+ }
+ }
+
+ # coalesce empty registers into a single line.
+ if (@empty_regs) {
+ my @runs;
+ my $run_start;
+ foreach my $i (0..$#empty_regs) {
+ my $cur = $empty_regs[$i];
+ my $next = $empty_regs[$i+1];
+
+ $run_start = $cur unless $run_start;
+ if (defined $next and ord($cur) + 1 == ord($next)) {
+ # extend range.
+ } else {
+ # terminate range and restart
+ my $run_str = $run_start;
+
+ if ($cur ne $run_start) {
+ $run_str .= "-$cur";
+ }
+ push @runs, $run_str;
+ $run_start = undef;
+ }
}
+ $active_window->print("Empty registers: " . join(', ', @runs));
}
} else {
_warn_ex(':registers');