… | |
… | |
266 | my ($self) = @_; |
266 | my ($self) = @_; |
267 | |
267 | |
268 | $self->hide; |
268 | $self->hide; |
269 | $self->emit ("destroy"); |
269 | $self->emit ("destroy"); |
270 | %$self = (); |
270 | %$self = (); |
|
|
271 | } |
|
|
272 | |
|
|
273 | sub TO_JSON { |
|
|
274 | { __widget_ref__ => $_[0]{s_id} } |
271 | } |
275 | } |
272 | |
276 | |
273 | sub show { |
277 | sub show { |
274 | my ($self) = @_; |
278 | my ($self) = @_; |
275 | |
279 | |
… | |
… | |
1969 | my $mod = $ev->{mod}; |
1973 | my $mod = $ev->{mod}; |
1970 | my $sym = $ev->{sym}; |
1974 | my $sym = $ev->{sym}; |
1971 | my $uni = $ev->{unicode}; |
1975 | my $uni = $ev->{unicode}; |
1972 | |
1976 | |
1973 | my $text = $self->get_text; |
1977 | my $text = $self->get_text; |
|
|
1978 | |
|
|
1979 | $self->{cursor} = List::Util::max 0, List::Util::min $self->{cursor}, length $text; |
1974 | |
1980 | |
1975 | if ($uni == 8) { |
1981 | if ($uni == 8) { |
1976 | substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; |
1982 | substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; |
1977 | } elsif ($uni == 127) { |
1983 | } elsif ($uni == 127) { |
1978 | substr $text, $self->{cursor}, 1, ""; |
1984 | substr $text, $self->{cursor}, 1, ""; |