ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/readline
Revision: 1.6
Committed: Sun Jan 22 20:39:47 2006 UTC (18 years, 4 months ago) by root
Branch: MAIN
CVS Tags: rel-7_3, rel-7_2, rel-7_5, rel-7_4, rel-7_3a
Changes since 1.5: +10 -0 lines
Log Message:
*** empty log message ***

File Contents

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