1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | sub on_button_press { |
3 | sub on_button_press { |
4 | my ($self, $event) = @_; |
4 | my ($self, $event) = @_; |
|
|
5 | |
|
|
6 | return |
|
|
7 | if $self->current_screen || $self->hidden_cursor; |
5 | |
8 | |
6 | my ($row, $col) = $self->screen_cur; |
9 | my ($row, $col) = $self->screen_cur; |
7 | my $line = $self->line ($row); |
10 | my $line = $self->line ($row); |
8 | my $cur = $line->offset_of ($row, $col); |
11 | my $cur = $line->offset_of ($row, $col); |
9 | my $ofs = $line->offset_of ($event->{row}, $event->{col}); |
12 | my $ofs = $line->offset_of ($event->{row}, $event->{col}); |
10 | |
13 | |
11 | if ($ofs >= 0 && $ofs < $line->l && !$self->current_screen) { |
14 | if ($ofs >= 0 && $ofs < $line->l) { |
12 | my $diff = $ofs - $cur; |
15 | my $diff = $ofs - $cur; |
13 | my $move; |
16 | my $move; |
14 | |
17 | |
15 | if ($diff < 0) { |
18 | if ($diff < 0) { |
16 | ($ofs, $cur) = ($cur, $ofs); |
19 | ($ofs, $cur) = ($cur, $ofs); |