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.6 by root, Sun Jan 22 20:39:47 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines