Created
April 12, 2026 06:37
-
-
Save paigeadelethompson/7d5ac8f44ed50bb0eda3fc34e0d262cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| use strict; | |
| use Irssi; | |
| use vars qw($VERSION %IRSSI); | |
| $VERSION = "1.1"; | |
| %IRSSI = ( | |
| authors => "Grok (fixed for IRC)", | |
| contact => "https://x.ai", | |
| name => "fullwidth", | |
| description => "Converts ALL your outgoing plain text to full-width letters (full width style). Normal spaces are kept so they don't break. Commands starting with / are untouched.", | |
| license => "Public Domain", | |
| url => "https://scripts.irssi.org", | |
| ); | |
| Irssi::settings_add_bool('misc', 'fullwidth_enabled', 1); | |
| # FIXED full-width function: | |
| # • Only converts ! to ~ → full-width equivalents | |
| # • Leaves regular spaces alone (this was the "ã@@" garbage you saw) | |
| sub fullwidth { | |
| my $text = shift // ''; | |
| $text =~ s/([\x21-\x7E])/chr(ord($1) + 0xFEE0)/ge; | |
| return $text; | |
| } | |
| sub sig_send_text { | |
| my ($text, $server, $witem) = @_; | |
| return unless Irssi::settings_get_bool('fullwidth_enabled'); | |
| return if $text =~ /^\s*\//; | |
| return unless $witem && ($witem->{type} eq 'CHANNEL' || $witem->{type} eq 'QUERY'); | |
| my $converted = fullwidth($text); | |
| Irssi::signal_stop(); | |
| $server->command("MSG " . $witem->{name} . " " . $converted); | |
| } | |
| sub cmd_fullwidth { | |
| my ($data) = @_; | |
| my $current = Irssi::settings_get_bool('fullwidth_enabled'); | |
| if ($data eq 'on') { | |
| Irssi::settings_set_bool('fullwidth_enabled', 1); | |
| Irssi::print('%GFull-width is now ON%n'); | |
| } elsif ($data eq 'off') { | |
| Irssi::settings_set_bool('fullwidth_enabled', 0); | |
| Irssi::print('%RFull-width is now OFF%n'); | |
| } else { | |
| my $new = !$current; | |
| Irssi::settings_set_bool('fullwidth_enabled', $new); | |
| Irssi::print('%GFull-width is now ' . ($new ? 'ON' : 'OFF') . '%n'); | |
| } | |
| } | |
| Irssi::signal_add('send text', 'sig_send_text'); | |
| Irssi::command_bind('fullwidth', 'cmd_fullwidth'); | |
| Irssi::print('%Gfullwidth.pl v1.1 loaded!%n Spaces are now fixed — messages will look like: ok thats better'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment