From: Rhonda D'Vine Date: Sun, 21 May 2023 07:47:31 +0000 (+0200) Subject: [colon_emoji] Add tab completion signal (#847) X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=f21e14c43526c2de4077f5a79ef9873b4dd0d3e2;p=irssi-scripts.irssi.org.git [colon_emoji] Add tab completion signal (#847) * Add tab completion signal If your colon emoji completes, this will get processed now --- diff --git a/scripts/colon_emoji.pl b/scripts/colon_emoji.pl index e7f98c4..43072a8 100644 --- a/scripts/colon_emoji.pl +++ b/scripts/colon_emoji.pl @@ -1,10 +1,10 @@ use strict; use warnings; -our $VERSION = '0.3'; +our $VERSION = '0.4'; our %IRSSI = ( - authors => 'Lars Djerf, Nei, Phoenix616', - contact => 'lars.djerf@gmail.com, Nei @ anti@conference.jabber.teamidiot.de, Phoenix616 @ mail@moep.tv', + authors => 'Lars Djerf, Nei, Phoenix616, Rhonda D\'Vine', + contact => 'lars.djerf@gmail.com, Nei @ anti@conference.jabber.teamidiot.de, Phoenix616 @ mail@moep.tv, rhonda @ deb.at', name => 'colon_emoji', description => 'Replace words between :...: in messages according to a text file. Was intended for Unicode Emoji on certain proprietary platforms.', license => 'GPLv3', @@ -36,6 +36,8 @@ our %IRSSI = ( # Changelog # ========= # 0.2: Handle outgoing messages +# 0.3: ??? +# 0.4: tab completion added # use File::Basename 'dirname'; @@ -76,6 +78,18 @@ sub sig_send { } } +sub sig_complete { + my ($list, $window, $word, $linestart, $want_space) = @_; + return unless $word =~ /^:/i; + my @newlist; + my ($str) = $word =~ /^:(.*):?$/; + foreach (keys %emojie) { + push @newlist, $emojie{$_} if /^(\Q$str\E.*)$/; + } + push @$list, $_ foreach @newlist; + Irssi::signal_stop(); +} + sub event_message { my ($server, $msg, @rest) = @_; $msg =~ s/$regex/$emojie{$1}/g; @@ -142,5 +156,6 @@ Irssi::signal_add_first('message public' => 'sig_message_public'); Irssi::signal_add_first('message private' => 'sig_message_private'); Irssi::signal_add_first('send command' => 'sig_send'); Irssi::signal_add_first('send text' => 'sig_send'); +Irssi::signal_add_first('complete word', 'sig_complete'); init();