]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Will now skip checking urls but still check the rest of the words in the input.
authorCraig Hammond <redacted>
Sun, 1 Feb 2015 01:39:38 +0000 (21:39 -0400)
committerCraig Hammond <redacted>
Sun, 1 Feb 2015 01:39:38 +0000 (21:39 -0400)
scripts/spellcheck.pl

index a4c5bf298a1e828d98e7e9a77279062ad16ae5d5..349a20ebef6a915a4a4041def72cec6012dc9860 100644 (file)
@@ -171,20 +171,23 @@ sub spellcheck_key_pressed
     my $inputline = Irssi::parse_special('$L');
 
     # check if inputline starts with any of cmdchars
-    # or contains protocols, we shouldn't spellcheck either
+    # we shouldn't spellcheck commands
     my $cmdchars = Irssi::settings_get_str('cmdchars');
-    my $cmdre = qr/^[$cmdchars]/;
-    my $protocolre = qr/[a-zA-Z]+:\/\/\S+/;
-    return if ($inputline =~ $cmdre or $inputline =~ $protocolre);
+    my $re = qr/^[$cmdchars]/;
+    return if ($inputline =~ $re);
 
     # get last bit from the inputline
     my ($word) = $inputline =~ /\s*([^\s]+)$/;
 
+    # do not spellcheck urls
+    my $re = qr/([a-zA-Z]+:\/\/\S+)|(^www)/;
+    return if ($word =~ $re);
+
     # find appropriate language for current window item
     my $lang = spellcheck_find_language($win->{active_server}->{tag}, $win->{active}->{name});
 
     my @suggestions = spellcheck_check_word($lang, $word, 0);
-    # Irssi::print("Debug: spellcheck_check_word($word) returned array of " . scalar @suggestions);
+    #Irssi::print("Debug: spellcheck_check_word($word) returned array of " . scalar @suggestions);
     return if (scalar @suggestions == 0);
 
     # we found a mistake, print suggestions
git clone https://git.99rst.org/PROJECT