url-select: updated README, on_line_update -> line_update
This commit is contained in:
parent
91cd34f1a1
commit
ec0f6210f4
10
README.md
10
README.md
@ -46,11 +46,11 @@ After installing, put the folling lines in your .Xdefaults:
|
|||||||
|
|
||||||
Use Meta-u to activate URL selection mode, then use the following keys:
|
Use Meta-u to activate URL selection mode, then use the following keys:
|
||||||
|
|
||||||
k: select next upward URL (also with Meta-u)
|
k: Select next upward URL (also with Meta-u)
|
||||||
j: select next downward URL
|
j: Select next downward URL
|
||||||
Return: open selected URL in browser and quit selection mode
|
o/Return: Open selected URL in browser, Return: deactivate afterwards
|
||||||
y: copy (yank) selected URL and quit selection mode
|
y: Copy (yank) selected URL and deactivate selection mode
|
||||||
Escape: cancel URL selection mode
|
q/Escape: Deactivate URL selection mode
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
|
26
url-select
26
url-select
@ -46,31 +46,29 @@ sub on_start {
|
|||||||
# 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') {
|
||||||
$self->{underline} = 1;
|
$self->enable(line_update => \&line_update);
|
||||||
}
|
}
|
||||||
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub on_line_update {
|
sub line_update {
|
||||||
my ($self, $row) = @_;
|
my ($self, $row) = @_;
|
||||||
|
|
||||||
if ($self->{underline}) {
|
my $line = $self->line($row);
|
||||||
my $line = $self->line($row);
|
my $text = $line->t;
|
||||||
my $text = $line->t;
|
my $rend = $line->r;
|
||||||
my $rend = $line->r;
|
|
||||||
|
|
||||||
while ($text =~ /$url_matcher/g) {
|
while ($text =~ /$url_matcher/g) {
|
||||||
my $url = $1;
|
my $url = $1;
|
||||||
my ($beg, $end) = ($-[1], $+[1] - 1);
|
my ($beg, $end) = ($-[1], $+[1] - 1);
|
||||||
--$end if $url =~ /["')]$/;
|
--$end if $url =~ /["')]$/;
|
||||||
|
|
||||||
for (@{$rend}[$beg .. $end]) {
|
for (@{$rend}[$beg .. $end]) {
|
||||||
$_ |= urxvt::RS_Uline;
|
$_ |= urxvt::RS_Uline;
|
||||||
}
|
|
||||||
$line->r($rend);
|
|
||||||
}
|
}
|
||||||
|
$line->r($rend);
|
||||||
}
|
}
|
||||||
|
|
||||||
()
|
()
|
||||||
|
Loading…
Reference in New Issue
Block a user