From 8108c454e3133de2d9291c1bc58ef8c32e80fc6a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 2 Nov 2021 10:31:29 +0100 Subject: Rename href to match. This extension is no longer limited to just URLs. --- reselect | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/reselect b/reselect index 2bc19d0..d0f9af1 100644 --- a/reselect +++ b/reselect @@ -2,6 +2,9 @@ # Author: Chip Camden + +use English; + my @hintchars = split //,'jfkdlsahgiroemcx'; my $re_url = @@ -48,7 +51,7 @@ sub find_matches { my @matches; while ($text =~ /$pattern/g) { my $ndx = $-[0]; - my $href = $&; + my $match = $MATCH; my $col = 0; my $row = 0; @@ -62,7 +65,7 @@ sub find_matches { } } if ($row >= 0) { - push(@matches, [$col, $row, $href]); + push(@matches, [$col, $row, $match]); } } @@ -81,14 +84,14 @@ sub build_overlays { my $hints = hint_iterator(); for my $ov (@overlays) { - my ($col, $row, $href) = @$ov; + my ($col, $row, $match) = @$ov; my $hint = $hints->(); my $overlay = $self->overlay($col, $row, $self->strwidth($hint), 1, $label_rend, 0); $overlay->set(0, 0, $hint); - $results->{$hint} = {label => $overlay, match => $href}; + $results->{$hint} = {label => $overlay, match => $match}; } return $results; @@ -204,14 +207,14 @@ sub update { } sub launch { - my ($self, $href) = @_; + my ($self, $match) = @_; my $p = $self->{url_picker}; $self->screen_cur($p->{crow},$p->{ccol}); $self->{url_picker} = (); - $self->status_msg($href); + $self->status_msg($match); - $self->selection($href, 1); + $self->selection($match, 1); $self->selection_grab(urxvt::CurrentTime, 1); } -- cgit v1.2.3