summaryrefslogtreecommitdiffstats
path: root/scripts/spellcheck.pl
diff options
context:
space:
mode:
authorGeert Hauwaerts2015-06-12 19:09:20 +0200
committerGeert Hauwaerts2015-06-12 19:09:20 +0200
commit930d70258e48949bf7c675d3f4c60744a5217e2a (patch)
tree4d9e30f17069b6e505a75096253b1d51c46220db /scripts/spellcheck.pl
parent0a0ba125acd8e929dfcd4809f900ce251b5ddc50 (diff)
parent2b5f93b005bfa0aa325d9ba3c4d0b64f2584f970 (diff)
downloadscripts.irssi.org-930d70258e48949bf7c675d3f4c60744a5217e2a.tar.bz2
Merge pull request #128 from chamm/spellcheckfix
spellcheck.pl - Fix for urls
Diffstat (limited to 'scripts/spellcheck.pl')
-rw-r--r--scripts/spellcheck.pl10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/spellcheck.pl b/scripts/spellcheck.pl
index 158ea3c..cc81487 100644
--- a/scripts/spellcheck.pl
+++ b/scripts/spellcheck.pl
@@ -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',
@@ -173,12 +173,16 @@ sub spellcheck_key_pressed
# check if inputline starts with any of cmdchars
# we shouldn't spellcheck commands
my $cmdchars = Irssi::settings_get_str('cmdchars');
- my $re = qr/^[$cmdchars]/;
- return if ($inputline =~ $re);
+ my $cmdre = qr/^[$cmdchars]/;
+ return if ($inputline =~ $cmdre);
# get last bit from the inputline
my ($word) = $inputline =~ /\s*([^\s]+)$/;
+ # do not spellcheck urls
+ my $urlre = qr/(^[a-zA-Z]+:\/\/\S+)|(^www)/;
+ return if ($word =~ $urlre);
+
# find appropriate language for current window item
my $lang = spellcheck_find_language($win->{active_server}->{tag}, $win->{active}->{name});