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