aboutsummaryrefslogtreecommitdiff
path: root/urxvt/ext
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-06-19 11:26:23 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-06-19 11:26:23 +1200
commitb4cb2c13839b021b46a16dd139c5b95f22f63448 (patch)
treec764f9a1cf84e48326aa214e10fc9bbbe9023d37 /urxvt/ext
parent992e085ca4ab6ff1a3e76594f8c50646bdbd002e (diff)
downloaddotfiles-b4cb2c13839b021b46a16dd139c5b95f22f63448.tar.gz
dotfiles-b4cb2c13839b021b46a16dd139c5b95f22f63448.zip
Remove @mark_patterns/@simplify_patterns
Diffstat (limited to 'urxvt/ext')
-rw-r--r--urxvt/ext/selection54
1 files changed, 1 insertions, 53 deletions
diff --git a/urxvt/ext/selection b/urxvt/ext/selection
index fe3bc3af..cf8dd142 100644
--- a/urxvt/ext/selection
+++ b/urxvt/ext/selection
@@ -22,51 +22,6 @@ sub on_init {
()
}
-# "find interesting things"-patterns
-my @mark_patterns = (
-# qr{ ([[:word:]]+) }x,
- qr{ ([^[:space:]]+) }x,
-
- # common types of "parentheses"
- qr{ (?<![^[:space:]]) [`'] ([^`']+) [`'] (?![^[:space:]]) }x,
- qr{ (?<![^[:space:]]) ‘ ([^‘’]+) ’ (?![^[:space:]]) }x,
- qr{ (?<![^[:space:]]) “ ([^“”]+) ” (?![^[:space:]]) }x,
-
- qr{ (?<![^[:space:]]) (' [^[:space:]] [^']* ') }x,
- qr{ (' [^']* [^[:space:]] ') (?![^[:space:]]) }x,
- qr{ (?<![^[:space:]]) (` [^[:space:]] [^']* ') }x,
- qr{ (` [^']* [^[:space:]] ') (?![^[:space:]]) }x,
- qr{ (?<![^[:space:]]) (" [^[:space:]] [^"]* ") }x,
- qr{ (" [^"]* [^[:space:]] ") (?![^[:space:]]) }x,
-
- qr{ \{ ([^\{\}]+) \} }x,
- qr{ \( ([^\(\)]+) \) }x,
- qr{ \[ ([^\[\]]+) \] }x,
- qr{ \< ([^\<\>]+) \> }x,
-
- # urls, just a heuristic
- qr{(
- (?:https?://|ftp://|news://|mailto:|file://|\bwww\.)[ab-zA-Z0-9\-\@;\/?:&=%\$_.+!*\x27(),~#]+
- [ab-zA-Z0-9\-\@;\/?:&=%\$_+*()~] # exclude some trailing characters (heuristic)
- )}x,
-
- # shell-like argument quoting, basically always matches
- qr{\G [\ \t|&;<>()]* (
- (?:
- [^\\"'\ \t|&;<>()]+
- | \\.
- | " (?: [^\\"]+ | \\. )* "
- | ' [^']* '
- )+
- )}x,
-);
-
-# "correct obvious? crap"-patterns
-my @simplify_patterns = (
- qr{^"([^\\"'\ \t|&;<>()*?]+)"$}, # "simple" => simple
- qr{^(.*)[,\-]$}, # strip off trailing , and -
-);
-
sub on_sel_extend {
my ($self, $time) = @_;
@@ -85,19 +40,12 @@ sub on_sel_extend {
if ($markofs < $line->l) {
study $text; # _really_ helps, too :)
- for my $regex (@mark_patterns, @{ $self->{patterns} }) {
+ for my $regex ( @{ $self->{patterns} }) {
while ($text =~ /$regex/g) {
if ($-[1] <= $markofs and $markofs <= $+[1]) {
my $ofs = $-[1];
my $match = $1;
- for my $regex (@simplify_patterns) {
- if ($match =~ $regex) {
- $match = $1;
- $ofs += $-[1];
- }
- }
-
push @matches, [$ofs, length $match];
}
}