[PATCH] Feature addition to selection extension (select to EOL)
Jason McCarver
slam at parasite.cc
Tue Sep 21 17:51:04 CEST 2010
All,
I've recently switched from Eterm to rxvt-unicode. I like the
selection extension but miss having the selection go from the current
position to the end of the line.
I've added a similar selection feature to the already excellent
selection extension bundled with rxvt-unicode. It may be enabled in
the config (it is disabled by default).
I freely admit to not being familiar with X, X resources, or urxvt
internals so there's every possibility this could be better. But it
does seem to work for me and I'm happy with it so far :)
--- selection 2009-12-26 04:50:46.000000000 -0600
+++ /home/jmccarv/.rxvt-unicode/selection-eol 2010-09-16 10:16:55.000000000 -0500
@@ -23,6 +23,10 @@
push @{ $self->{patterns} }, qr/$res/;
}
+ my $selToEOL = $self->locale_decode($self->x_resource('selection.selToEOL'));
+ utf8::encode $selToEOL;
+ $self->{selToEOL} = defined $selToEOL && ($selToEOL =~ /true|yes|1/i);
+
$self->{enabled} = 1;
push @{ $self->{term}{option_popup_hook} }, sub {
@@ -125,6 +129,10 @@
}
}
+ # start of current selection to EOL
+ push @matches, [$line->offset_of($self->selection_beg), (($line->end - $line->beg + 1) * $self->ncol) - $line->offset_of($self->selection_beg)]
+ if ($self->{selToEOL} && $line->offset_of($self->selection_beg) > 0);
+
# whole line
push @matches, [0, ($line->end - $line->beg + 1) * $self->ncol];
--
Jason McCarver (slam at parasite.cc)
More information about the rxvt-unicode
mailing list