ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/readline
(Generate patch)

Comparing rxvt-unicode/src/perl/readline (file contents):
Revision 1.3 by root, Fri Jan 20 22:49:34 2006 UTC vs.
Revision 1.7 by root, Mon Feb 6 06:14:08 2006 UTC

1#! perl 1#! perl
2
3use POSIX ();
4
5my $termios = new POSIX::Termios;
6
7sub on_init {
8 my ($self) = @_;
9
10 $self->{enabled} = 1;
11
12 push @{ $self->{term}{option_popup_hook} }, sub {
13 ("readline" => $self->{enabled}, sub { $self->{enabled} = shift })
14 };
15
16 ()
17}
2 18
3sub on_button_press { 19sub on_button_press {
4 my ($self, $event) = @_; 20 my ($self, $event) = @_;
21
22 return
23 if $self->current_screen || $self->hidden_cursor || !$self->{enabled};
24
25 $termios->getattr ($self->pty_fd)
26 or return;
27
28 return
29 if $termios->getlflag & &POSIX::ICANON;
5 30
6 my ($row, $col) = $self->screen_cur; 31 my ($row, $col) = $self->screen_cur;
7 my $line = $self->line ($row); 32 my $line = $self->line ($row);
8 my $cur = $line->offset_of ($row, $col); 33 my $cur = $line->offset_of ($row, $col);
9 my $ofs = $line->offset_of ($event->{row}, $event->{col}); 34 my $ofs = $line->offset_of ($event->{row}, $event->{col});
10 35
11 if ($ofs >= 0 && $ofs < $line->l && !$self->current_screen) { 36 if ($ofs >= 0 && $ofs < $line->l) {
12 my $diff = $ofs - $cur; 37 my $diff = $ofs - $cur;
13 my $move; 38 my $move;
14 39
15 if ($diff < 0) { 40 if ($diff < 0) {
16 ($ofs, $cur) = ($cur, $ofs); 41 ($ofs, $cur) = ($cur, $ofs);
18 } else { 43 } else {
19 $move = "\x1b[C"; 44 $move = "\x1b[C";
20 } 45 }
21 46
22 my $skipped = substr $line->t, $cur, $ofs - $cur; 47 my $skipped = substr $line->t, $cur, $ofs - $cur;
23 $skipped =~ s/$urxvt::NOCHAR//g; 48 $skipped =~ s/\x{ffff}//g;
24 49
25 $self->tt_write ($move x length $skipped); 50 $self->tt_write ($move x length $skipped);
26 } 51 }
27 52
28 () 53 ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines