… | |
… | |
37 | my ($row, $col) = $self->screen_cur; |
37 | my ($row, $col) = $self->screen_cur; |
38 | my $line = $self->line ($row); |
38 | my $line = $self->line ($row); |
39 | my $cur = $line->offset_of ($row, $col); |
39 | my $cur = $line->offset_of ($row, $col); |
40 | my $ofs = $line->offset_of ($event->{row}, $event->{col}); |
40 | my $ofs = $line->offset_of ($event->{row}, $event->{col}); |
41 | |
41 | |
42 | if ($ofs >= 0 && $ofs < $line->l) { |
42 | $ofs >= 0 && $ofs < $line->l |
43 | my $diff = $ofs - $cur; |
43 | or return; |
44 | my $move; |
|
|
45 | |
44 | |
46 | if ($diff < 0) { |
45 | my $diff = $ofs - $cur; |
47 | ($ofs, $cur) = ($cur, $ofs); |
46 | my $move; |
48 | $move = "\x1b[D"; |
|
|
49 | } else { |
|
|
50 | $move = "\x1b[C"; |
|
|
51 | } |
|
|
52 | |
47 | |
53 | my $skipped = substr $line->t, $cur, $ofs - $cur; |
48 | if ($diff < 0) { |
54 | $skipped =~ s/\x{ffff}//g; |
49 | ($ofs, $cur) = ($cur, $ofs); |
55 | |
50 | $move = "\x1b[D"; |
56 | $self->tt_write ($move x length $skipped); |
51 | } else { |
|
|
52 | $move = "\x1b[C"; |
57 | } |
53 | } |
58 | |
54 | |
59 | () |
55 | my $skipped = substr $line->t, $cur, $ofs - $cur; |
|
|
56 | $skipped =~ s/\x{ffff}//g; |
|
|
57 | |
|
|
58 | $self->tt_write ($move x length $skipped); |
|
|
59 | |
|
|
60 | 1 |
60 | } |
61 | } |