]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Prevent urls from generating spelling corrections.
authorCraig Hammond <redacted>
Sat, 31 Jan 2015 22:23:08 +0000 (18:23 -0400)
committerCraig Hammond <redacted>
Sat, 31 Jan 2015 22:23:08 +0000 (18:23 -0400)
scripts/spellcheck.pl

index 158ea3cd9347810bccc09a4262af6a9a119afc54..a4c5bf298a1e828d98e7e9a77279062ad16ae5d5 100644 (file)
@@ -60,7 +60,7 @@ use vars qw($VERSION %IRSSI);
 use Irssi 20070804;
 use Text::Aspell;
 
-$VERSION = '0.3';
+$VERSION = '0.4';
 %IRSSI = (
     authors     => 'Jakub Jankowski',
     contact     => 'shasta@toxcorp.com',
@@ -171,10 +171,11 @@ sub spellcheck_key_pressed
     my $inputline = Irssi::parse_special('$L');
 
     # check if inputline starts with any of cmdchars
-    # we shouldn't spellcheck commands
+    # or contains protocols, we shouldn't spellcheck either
     my $cmdchars = Irssi::settings_get_str('cmdchars');
-    my $re = qr/^[$cmdchars]/;
-    return if ($inputline =~ $re);
+    my $cmdre = qr/^[$cmdchars]/;
+    my $protocolre = qr/[a-zA-Z]+:\/\/\S+/;
+    return if ($inputline =~ $cmdre or $inputline =~ $protocolre);
 
     # get last bit from the inputline
     my ($word) = $inputline =~ /\s*([^\s]+)$/;
git clone https://git.99rst.org/PROJECT