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}); |