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.1 by root, Fri Jan 20 22:05:41 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) { 24 if ($ofs >= 0 && $ofs < $line->l) {
12 my $diff = $ofs - $cur; 25 my $diff = $ofs - $cur;
26 my $move;
13 27
14 $self->tt_write ($diff < 0 ? "\x1b[D" x -$diff 28 if ($diff < 0) {
15 : "\x1b[C" x $diff); 29 ($ofs, $cur) = ($cur, $ofs);
30 $move = "\x1b[D";
31 } else {
32 $move = "\x1b[C";
33 }
16 34
17 return 1; 35 my $skipped = substr $line->t, $cur, $ofs - $cur;
36 $skipped =~ s/\x{ffff}//g;
37
38 $self->tt_write ($move x length $skipped);
18 } 39 }
19 40
20 () 41 ()
21} 42}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines