diff options
author | Tom Feist <shabble@metavore.org> | 2011-05-24 19:14:26 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-05-24 19:14:26 +0000 |
commit | 69c4b25ec9c0079eea052ebd1d8cf70f20372611 (patch) | |
tree | 14685763f3ca9c11a5f0af731135a72209fecd00 | |
parent | notifyquit: oops, wrong branch. Now merged to master (diff) | |
download | irssi-scripts-69c4b25ec9c0079eea052ebd1d8cf70f20372611.tar.gz irssi-scripts-69c4b25ec9c0079eea052ebd1d8cf70f20372611.zip |
tab_stop: added tab_stop, a bit of a rework of an old script to replace the
inverted I with some configurable thing.
-rw-r--r-- | tab_stop/tab_stop.pl | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tab_stop/tab_stop.pl b/tab_stop/tab_stop.pl new file mode 100644 index 0000000..2774167 --- /dev/null +++ b/tab_stop/tab_stop.pl @@ -0,0 +1,49 @@ +# Created by Stefan "tommie" Tomanek [stefan@kann-nix.org] +# to free the world from the evil inverted I +# +# 23.02.2002 +# *First release +# +# 01.03.200? +# *Changed to GPL +# +# 24.05.2011 +# * Buggered about with by shabble. + +use strict; +use warnings; + +use Irssi; + +our $VERSION = "20110524"; +our %IRSSI = ( + authors => "Stefan 'tommie' Tomanek, shabble", + contact => "stefan\@pico.ruhr.de, shabble@#irssi/Freenode", + name => "tab_stop", + description => 'Replaces \t TAB characters with ' + . 'contents of /set tabstop_replacement', + license => "GPLv2", + changed => "$VERSION", + ); + +my $not_tab; + +sub sig_gui_print_text { + return unless $_[4] =~ /\t/; + $_[4] =~ s/\t/$not_tab/g; + Irssi::signal_continue(@_); +} + +# create an expando $TAB which produces real tabs +Irssi::expando_create('TAB', sub { "\t" }, { 'gui exit' => 'never' }); + +# then rewrite them just before they're printed. +Irssi::signal_add_first('gui print text', \&sig_gui_print_text); +Irssi::signal_add('setup changed', \&sig_setup_changed); +Irssi::settings_add_str('misc', 'tabstop_replacement', " "); + +sub sig_setup_changed { + $not_tab = Irssi::settings_get_str('tabstop_replacement'); +} + +sig_setup_changed(); |