summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_data/scripts.yaml4
-rw-r--r--scripts/perlalias.pl30
2 files changed, 31 insertions, 3 deletions
diff --git a/_data/scripts.yaml b/_data/scripts.yaml
index 6578638..a6b2785 100644
--- a/_data/scripts.yaml
+++ b/_data/scripts.yaml
@@ -3605,9 +3605,9 @@
description: 'Quickly create commands from short perl blocks'
filename: perlalias.pl
license: 'public domain'
- modified: '2017-01-21 05:12:33'
+ modified: '2017-02-19 12:53:47'
name: perlalias
- version: '1.1'
+ version: '1.2'
-
authors: 'Adam Duck'
contact: duck@cs.uni-frankfurt.de
diff --git a/scripts/perlalias.pl b/scripts/perlalias.pl
index bb3b306..b546688 100644
--- a/scripts/perlalias.pl
+++ b/scripts/perlalias.pl
@@ -75,7 +75,7 @@ use POSIX qw(strftime);
{ package Irssi::Nick; } # Keeps trying to look for this package but for some reason it doesn't get loaded.
-our $VERSION = '1.1';
+our $VERSION = '1.2';
our %IRSSI = (
authors => 'aquanight',
contact => 'aquanight@gmail.com',
@@ -235,6 +235,34 @@ sub sig_setup_reread {
close $fd;
}
+sub sig_complete_perlalias {
+ my ($lst, $win, $word, $line, $want_space) = @_;
+ $word//return;
+ $line//return;
+ $lst//return;
+ if ($line ne '') {
+ my $def = $cmds{$line};
+ $def//return;
+ push @$lst, $def->{textcmd};
+ Irssi::signal_stop();
+ }
+ else {
+ push @$lst, (grep /^\Q$word\E/i, keys %cmds);
+ Irssi::signal_stop();
+ }
+}
+
+sub sig_complete_perlunalias {
+ my ($lst, $win, $word, $line, $want_space) = @_;
+ $lst//return;
+ $word//return;
+ push @$lst, (grep /^\Q$word\E/i, keys %cmds);
+}
+
+Irssi::signal_register({"complete command " => [qw(glistptr_char* Irssi::UI::Window string string intptr)]});
+Irssi::signal_add("complete command perlalias" => \&sig_complete_perlalias);
+Irssi::signal_add("complete command perlunalias" => \&sig_complete_perlunalias);
+
Irssi::signal_add("setup saved" => \&sig_setup_saved);
Irssi::signal_add("setup reread" => \&sig_setup_reread);