ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/readline
Revision: 1.4
Committed: Sat Jan 21 08:07:39 2006 UTC (18 years, 4 months ago) by root
Branch: MAIN
Changes since 1.3: +4 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl
2
3 sub on_button_press {
4 my ($self, $event) = @_;
5
6 return
7 if $self->current_screen || $self->hidden_cursor;
8
9 my ($row, $col) = $self->screen_cur;
10 my $line = $self->line ($row);
11 my $cur = $line->offset_of ($row, $col);
12 my $ofs = $line->offset_of ($event->{row}, $event->{col});
13
14 if ($ofs >= 0 && $ofs < $line->l) {
15 my $diff = $ofs - $cur;
16 my $move;
17
18 if ($diff < 0) {
19 ($ofs, $cur) = ($cur, $ofs);
20 $move = "\x1b[D";
21 } else {
22 $move = "\x1b[C";
23 }
24
25 my $skipped = substr $line->t, $cur, $ofs - $cur;
26 $skipped =~ s/$urxvt::NOCHAR//g;
27
28 $self->tt_write ($move x length $skipped);
29 }
30
31 ()
32 }