diff options
author | Tom Feist <shabble@metavore.org> | 2010-10-08 00:44:42 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2010-10-08 00:44:42 +0000 |
commit | 7c447b8328be2e404fa3d34780da3c0e954082d0 (patch) | |
tree | 57d5304bbfb44916310be5b8b76293aa4c5cc520 /prompt_info | |
parent | added prompt_replace to dev branch (diff) | |
parent | vim_mode: Fix :registers' display of "+ and "*. (diff) | |
download | irssi-scripts-7c447b8328be2e404fa3d34780da3c0e954082d0.tar.gz irssi-scripts-7c447b8328be2e404fa3d34780da3c0e954082d0.zip |
Merge remote branch 'origin/dev' into dev
Conflicts:
prompt_info/prompt_replace.pl
test/irssi/config
Diffstat (limited to 'prompt_info')
-rw-r--r-- | prompt_info/overlays.pl | 89 | ||||
-rw-r--r-- | prompt_info/prompt_info.pl | 26 | ||||
-rw-r--r-- | prompt_info/prompt_replace.pl | 2 |
3 files changed, 113 insertions, 4 deletions
diff --git a/prompt_info/overlays.pl b/prompt_info/overlays.pl new file mode 100644 index 0000000..47a3eef --- /dev/null +++ b/prompt_info/overlays.pl @@ -0,0 +1,89 @@ +# temp place for dumping all the stuff that doesn't belong in uberprompt. + +# overlay := { $num1 => line1, $num2 => line2 } +# line := [ region, region, region ] +# region := { start => x, end => y, ...? } + +my $overlay; + + + +sub _add_overlay_region { + my ($line, $start, $end, $text, $len) = @_; + my $region = { start => $start, + end => $end, + text => $text, + len => $len }; + + my $o_line = $overlay->{$line}; + + unless (defined $o_line) { + $o_line = []; + $overlay->{$line} = $o_line; + } + + foreach my $cur_region (@$o_line) { + if (_region_overlaps($cur_region, $region)) { + # do something. + print "Region overlaps"; + last; + } + } + + push @$o_line, $region; + +} + +sub _remove_overlay_region { + my ($line, $start, $end) = @_; + + my $o_line = $overlay->{$line}; + return unless $o_line; + + my $i = 0; + foreach my $region (@$o_line) { + if ($region->{start} == $start && $region->{end} == $end) { + last; + } + $i++; + } + splice @$o_line, $i, 1, (); # remove it. +} + +sub _redraw_overlay { + foreach my $line_num (sort keys %$overlay) { + my $line = $overlay->{$line_num}; + + foreach my $region (@$line) { + Irssi::gui_printtext($region->{start}, $line_num, + $region->{text}); + } + } +} + +sub init { + +} +sub _clear_overlay { + Irssi::active_win->view->redraw(); +} + +sub _draw_overlay_menu { + + my $w = 10; + + my @lines = ( + '%7+' . ('-' x $w) . '+%n', + sprintf('%%7|%%n%*s%%7|%%n', $w, 'bacon'), + sprintf('|%*s|', $w, 'bacon'), + sprintf('|%*s|', $w, 'bacon'), + sprintf('|%*s|', $w, 'bacon'), + sprintf('|%*s|', $w, 'bacon'), + sprintf('|%*s|', $w, 'bacon'), + '%7+' . ('-' x $w) . '+%n', + ); + my $i = 10; # start vert offset. + for my $line (@lines) { + Irssi::gui_printtext(int ($term_w / 2), $i++, $line); + } +} diff --git a/prompt_info/prompt_info.pl b/prompt_info/prompt_info.pl index 51e5c16..8ad63ba 100644 --- a/prompt_info/prompt_info.pl +++ b/prompt_info/prompt_info.pl @@ -9,10 +9,30 @@ # # prompt = "[$*$prompt_additional] " # -# Then add this script to your autorun directory (~/.irssi/scripts/autorun/) +# Then place this script to your ~/.irssi/scripts directory (~/.irssi/scripts/) +# and symlink it to the ~/.irssi/scripts/autorun directory (which may need to +# be created first) # -# You can modify your prompt content by using the '/set_prompt <string>' command, -# or from scripts by Irssi:signal_emit('change prompt', $string); +# You can also load it manually once the theme has been edited via +# +# /script load prompt_info.pl +# +# You will also need to reload your theme with the following command: +# +# /script exec Irssi::themes_reload() +# +# Once loaded, you can modify your prompt content by using the following command: +# +# /set_prompt <string> +# +# You can also use it from other scripts by issuing a signal as follows: +# +# Irssi:signal_emit('change prompt', +# +# report bugs / feature requests to http://github.com/shabble/irssi-scripts/issues +# +# NOTE: it does not appear to be possible to use colours in your prompt at present. +# This is unlikely to change without source-code changes to Irssi itself. use strict; use warnings; diff --git a/prompt_info/prompt_replace.pl b/prompt_info/prompt_replace.pl index 4cab4be..30120f7 100644 --- a/prompt_info/prompt_replace.pl +++ b/prompt_info/prompt_replace.pl @@ -130,7 +130,6 @@ sub init { Irssi::signal_add('change prompt' => \&change_prompt_sig); Irssi::signal_register({'prompt changed' => [qw/string int/]}); - } sub change_prompt_sig { @@ -195,6 +194,7 @@ sub uberprompt_draw { my $ret = $sb_item->default_handler($get_size_only, $p_copy, '', 0); Irssi::signal_emit('prompt changed', $p_copy, $sb_item->{size}); + return $ret; } |