/usr/lib/urxvt/perl/readline is in rxvt-unicode 9.14-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #! perl
use POSIX ();
my $termios = new POSIX::Termios;
sub on_init {
my ($self) = @_;
$self->{enabled} = 1;
push @{ $self->{term}{option_popup_hook} }, sub {
("readline" => $self->{enabled}, sub { $self->{enabled} = shift })
};
()
}
sub on_button_press {
my ($self, $event) = @_;
$self->current_screen || $self->hidden_cursor || !$self->{enabled}
and return;
my $mask = $self->ModLevel3Mask | $self->ModMetaMask
| urxvt::ShiftMask | urxvt::ControlMask;
($event->{state} & $mask) == urxvt::ShiftMask
or return;
$termios->getattr ($self->pty_fd)
or return;
$termios->getlflag & &POSIX::ICANON
and return;
my ($row, $col) = $self->screen_cur;
my $line = $self->line ($row);
my $cur = $line->offset_of ($row, $col);
my $ofs = $line->offset_of ($event->{row}, $event->{col});
$ofs >= 0 && $ofs < $line->l
or return;
my $diff = $ofs - $cur;
my $move;
if ($diff < 0) {
($ofs, $cur) = ($cur, $ofs);
$move = "\x1b[D";
} else {
$move = "\x1b[C";
}
my $skipped = substr $line->t, $cur, $ofs - $cur;
$skipped =~ s/\x{ffff}//g;
$self->tt_write ($move x length $skipped);
1
}
|