From 15fc0c2cc4635f7a04e31d054ef34abbd3e63073 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Thu, 16 Sep 2010 16:25:01 +0100 Subject: fixed bug that tried to complete non-uri strings, and also added a check to see if its already been shortened to prevent recursive shortening. --- tinyurl-tabcomplete/complete-tiny-url.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tinyurl-tabcomplete') diff --git a/tinyurl-tabcomplete/complete-tiny-url.pl b/tinyurl-tabcomplete/complete-tiny-url.pl index e3100e4..ead811c 100644 --- a/tinyurl-tabcomplete/complete-tiny-url.pl +++ b/tinyurl-tabcomplete/complete-tiny-url.pl @@ -16,7 +16,9 @@ $VERSION = '2.1'; sub do_complete { my ($strings, $window, $word, $linestart, $want_space) = @_; return if $word eq ''; - if (defined (my $found_uri = match_uri($word))) { + my $found_uri = match_uri($word); + if (defined $found_uri && $found_uri !~ m/tinyurl\./i) { + print "Going to reduce: $found_uri"; my $uri = makeashorterlink($found_uri); push @$strings, $uri if $uri; $$want_space = 1; @@ -60,7 +62,7 @@ sub match_uri { $uri = 'http://' . $uri if $uri !~ m(http://); return $uri; } else { - return ''; + return undef; } } -- cgit v1.2.3