ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/readline
Revision: 1.11
Committed: Sun Nov 20 11:09:22 2011 UTC (12 years, 6 months ago) by sf-exg
Branch: MAIN
CVS Tags: rel-9_14, rxvt-unicode-rel-9_15
Changes since 1.10: +1 -1 lines
Log Message:
Remove trailing whitespace.

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.7 sub 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     }
18    
19 root 1.1 sub on_button_press {
20     my ($self, $event) = @_;
21    
22 root 1.8 $self->current_screen || $self->hidden_cursor || !$self->{enabled}
23     and return;
24    
25     my $mask = $self->ModLevel3Mask | $self->ModMetaMask
26     | urxvt::ShiftMask | urxvt::ControlMask;
27 sf-exg 1.11
28 root 1.8 ($event->{state} & $mask) == urxvt::ShiftMask
29     or return;
30 root 1.4
31 root 1.6 $termios->getattr ($self->pty_fd)
32     or return;
33    
34 root 1.8 $termios->getlflag & &POSIX::ICANON
35     and return;
36 root 1.6
37 root 1.1 my ($row, $col) = $self->screen_cur;
38     my $line = $self->line ($row);
39     my $cur = $line->offset_of ($row, $col);
40     my $ofs = $line->offset_of ($event->{row}, $event->{col});
41    
42 root 1.10 $ofs >= 0 && $ofs < $line->l
43     or return;
44 root 1.1
45 root 1.10 my $diff = $ofs - $cur;
46     my $move;
47 root 1.3
48 root 1.10 if ($diff < 0) {
49     ($ofs, $cur) = ($cur, $ofs);
50     $move = "\x1b[D";
51     } else {
52     $move = "\x1b[C";
53     }
54 root 1.3
55 root 1.10 my $skipped = substr $line->t, $cur, $ofs - $cur;
56     $skipped =~ s/\x{ffff}//g;
57 root 1.9
58 root 1.10 $self->tt_write ($move x length $skipped);
59 root 1.1
60 root 1.10 1
61 root 1.1 }