url-select: fixed matching of URLs with umlauts
This commit is contained in:
parent
383ae7083a
commit
cbdbb7927e
15
url-select
15
url-select
@ -2,7 +2,7 @@
|
|||||||
# Author: Bert Muennich
|
# Author: Bert Muennich
|
||||||
# Website: http://www.github.com/muennich/urxvt-perls
|
# Website: http://www.github.com/muennich/urxvt-perls
|
||||||
# Based on: http://www.jukie.net/~bart/blog/urxvt-url-yank
|
# Based on: http://www.jukie.net/~bart/blog/urxvt-url-yank
|
||||||
# Version: git-20100820
|
# Version: git-20100829
|
||||||
# License: GPLv2
|
# License: GPLv2
|
||||||
|
|
||||||
# Use keyboard shortcuts to select URLs.
|
# Use keyboard shortcuts to select URLs.
|
||||||
@ -29,20 +29,13 @@ use strict;
|
|||||||
|
|
||||||
my $url_matcher = qr{(
|
my $url_matcher = qr{(
|
||||||
(?:https?://|ftp://|news://|mailto:|file://|www\.)
|
(?:https?://|ftp://|news://|mailto:|file://|www\.)
|
||||||
[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~#]+[ab-zA-Z0-9\-\@;\/?&=%\$_+!*\x27()~]
|
[\w\-\@;\/?:&=%\$_.+!*\x27(),~#]+[\w\-\@;\/?&=%\$_+!*\x27()~]
|
||||||
)}x;
|
)}x;
|
||||||
|
|
||||||
|
|
||||||
sub on_start {
|
sub on_start {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
eval { require Regexp::Common::URI };
|
|
||||||
if(!$@) {
|
|
||||||
require Regexp::Common;
|
|
||||||
Regexp::Common->import('URI');
|
|
||||||
$url_matcher = $Regexp::Common::RE{URI}{HTTP};
|
|
||||||
}
|
|
||||||
|
|
||||||
# read resource settings
|
# read resource settings
|
||||||
$self->{browser} = $self->x_resource('urlLauncher') || 'x-www-browser';
|
$self->{browser} = $self->x_resource('urlLauncher') || 'x-www-browser';
|
||||||
if ($self->x_resource('underlineURLs') eq 'true') {
|
if ($self->x_resource('underlineURLs') eq 'true') {
|
||||||
@ -133,10 +126,8 @@ sub on_button_release {
|
|||||||
|
|
||||||
while ($text =~ /$url_matcher/g) {
|
while ($text =~ /$url_matcher/g) {
|
||||||
my ($url, $beg, $end) = ($1, $-[0], $+[0]);
|
my ($url, $beg, $end) = ($1, $-[0], $+[0]);
|
||||||
|
--$end if $url =~ s/["')]$//;
|
||||||
|
|
||||||
if ($url =~ s/["')]$//) {
|
|
||||||
--$end;
|
|
||||||
}
|
|
||||||
if ($col >= $beg && $col <= $end) {
|
if ($col >= $beg && $col <= $end) {
|
||||||
$self->exec_async($self->{browser}, $url);
|
$self->exec_async($self->{browser}, $url);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user