… | |
… | |
1972 | } elsif ($uni == 21) { # ctrl-u |
1972 | } elsif ($uni == 21) { # ctrl-u |
1973 | $text = ""; |
1973 | $text = ""; |
1974 | $self->{cursor} = 0; |
1974 | $self->{cursor} = 0; |
1975 | } elsif ($uni == 27) { |
1975 | } elsif ($uni == 27) { |
1976 | $self->emit ('escape'); |
1976 | $self->emit ('escape'); |
1977 | } elsif ($uni >= 0x20) { |
1977 | } elsif ($uni) { |
1978 | substr $text, $self->{cursor}++, 0, chr $uni; |
1978 | substr $text, $self->{cursor}++, 0, chr $uni; |
1979 | } else { |
1979 | } else { |
1980 | return 0; |
1980 | return 0; |
1981 | } |
1981 | } |
1982 | |
1982 | |
… | |
… | |
2104 | $self->set_text ($self->{history}->[$self->{history_pointer}]); |
2104 | $self->set_text ($self->{history}->[$self->{history_pointer}]); |
2105 | } else { |
2105 | } else { |
2106 | $self->set_text ($self->{history_saveback}); |
2106 | $self->set_text ($self->{history_saveback}); |
2107 | } |
2107 | } |
2108 | |
2108 | |
2109 | } else { |
2109 | } elsif ($ev->{unicode} >= 0x20) { |
2110 | return $self->SUPER::invoke_key_down ($ev) |
2110 | return $self->SUPER::invoke_key_down ($ev) |
2111 | } |
2111 | } |
2112 | |
2112 | |
2113 | 1 |
2113 | 1 |
2114 | } |
2114 | } |
… | |
… | |
2124 | sub move_cursor_ver { |
2124 | sub move_cursor_ver { |
2125 | my ($self, $dy) = @_; |
2125 | my ($self, $dy) = @_; |
2126 | |
2126 | |
2127 | my ($y, $x) = $self->{layout}->index_to_line_x ($self->{cursor}); |
2127 | my ($y, $x) = $self->{layout}->index_to_line_x ($self->{cursor}); |
2128 | |
2128 | |
2129 | do { |
2129 | $y += $dy; |
|
|
2130 | |
2130 | if (defined (my $index = $self->{layout}->line_x_to_index ($y + $dy, $x))) { |
2131 | if (defined (my $index = $self->{layout}->line_x_to_index ($y, $x))) { |
2131 | $self->{cursor} = $index; |
2132 | $self->{cursor} = $index; |
2132 | delete $self->{cur_h}; |
2133 | delete $self->{cur_h}; |
2133 | $self->update; |
2134 | $self->update; |
2134 | return; |
2135 | return; |
2135 | } |
2136 | } |
2136 | } while --$x >= 0; |
|
|
2137 | } |
2137 | } |
2138 | |
2138 | |
2139 | sub invoke_key_down { |
2139 | sub invoke_key_down { |
2140 | my ($self, $ev) = @_; |
2140 | my ($self, $ev) = @_; |
2141 | |
2141 | |