{
/* normal XTerm key bindings */
case XK_Insert: /* Shift+Insert = paste mouse selection */
- selection_request (ev.time, 0, 0);
+ selection_request (ev.time);
return;
#if TODO
/* rxvt extras */
case Button3:
selection_make (ev.time);
break;
+
case Button2:
- selection_request (ev.time, ev.x, ev.y);
+ if (IN_RANGE_EXC (ev.x, 0, width)
+ && IN_RANGE_EXC (ev.y, 0, height)) // inside window?
+ selection_request (ev.time);
+
break;
+
#ifdef MOUSE_WHEEL
case Button4:
case Button5:
sub on_start {
my ($self) = @_;
+
$pastebin_cmd = $self->x_resource ("selection-pastebin.cmd")
|| "rcp -p % ruth:/var/www/www.ta-sa.org/files/txt/";
$pastebin_url = $self->x_resource ("selection-pastebin.url")
|| "http://www.ta-sa.org/files/txt/%";
+ push @{ $self->{term}{selection_popup_hook} }, sub {
+ ("pastebin upload" => sub { $self->upload_paste })
+ };
+
()
}
-push @urxvt::ext::selection_popup::hook, sub {
- ("pastebin upload" => sub { $self->upload_paste })
-};
-
sub on_keyboard_command {
my ($self, $cmd) = @_;
()
}
-our @hook;
-
sub on_button_press {
my ($self, $event) = @_;
/^(http|ftp|telnet|irc|news):\//
and $add_button->("run $self->{browser}" => sub { $self->exec_async ($self->{browser}, $_) });
- for my $hook (@hook) {
+ for my $hook (@{ $self->{term}{selection_popup_hook} || [] }) {
if (my ($title, $cb) = $hook->($popup)) {
$add_button->($title, $cb);
}
void selection_check (int check_more);
void selection_paste (Window win, Atom prop, bool delete_prop);
void selection_property (Window win, Atom prop);
- void selection_request (Time tm, int x, int y);
+ void selection_request (Time tm);
int selection_request_other (Atom target, int selnum);
void selection_clear ();
void selection_make (Time tm);
* EXT: button 2 release
*/
void
-rxvt_term::selection_request (Time tm, int x, int y)
+rxvt_term::selection_request (Time tm)
{
- if (x < 0 || x >= width || y < 0 || y >= height)
- return; /* outside window */
-
if (selection.text)
{ /* internal selection */
char *str = rxvt_wcstombs (selection.text, selection.len);
text into various other formats/action (such as uri unescaping, perl
evalution, web-browser starting etc.), depending on content.
-Other extensions can extend this popup menu by pushing a code reference onto
-C<@urxvt::ext::selection_popup::hook>, that is called whenever the popup is displayed.
+Other extensions can extend this popup menu by pushing a code reference
+onto C<@{ $term->{selection_popup_hook} }>, that is called whenever the
+popup is displayed.
It's sole argument is the popup menu, which can be modified. The selection
is in C<$_>, which can be used to decide wether to add something or not.
the selection to C<b>s, but only if the selection currently contains any
C<a>s:
- push urxvt::ext::selection_popup::hook, sub {
+ push @{ $self->{term}{selection_popup_hook} }, sub {
/a/ ? ("a to be" => sub { s/a/b/g }
: ()
};
-Don't run it in a hook, otherwise the menu will grow and grow. Instead put
-it at the toplevel of your extension.
-
=item searchable-scrollback<hotkey> (enabled by default)
Adds regex search functionality to the scrollback buffer, triggered