… | |
… | |
1480 | my $sym = $ev->{sym}; |
1480 | my $sym = $ev->{sym}; |
1481 | my $uni = $ev->{unicode}; |
1481 | my $uni = $ev->{unicode}; |
1482 | |
1482 | |
1483 | my $text = $self->get_text; |
1483 | my $text = $self->get_text; |
1484 | |
1484 | |
1485 | if ($sym == 8) { |
1485 | if ($uni == 8) { |
1486 | substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; |
1486 | substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; |
1487 | } elsif ($sym == 127) { |
1487 | } elsif ($uni == 127) { |
1488 | substr $text, $self->{cursor}, 1, ""; |
1488 | substr $text, $self->{cursor}, 1, ""; |
1489 | } elsif ($sym == CFClient::SDLK_LEFT) { |
1489 | } elsif ($sym == CFClient::SDLK_LEFT) { |
1490 | --$self->{cursor} if $self->{cursor}; |
1490 | --$self->{cursor} if $self->{cursor}; |
1491 | } elsif ($sym == CFClient::SDLK_RIGHT) { |
1491 | } elsif ($sym == CFClient::SDLK_RIGHT) { |
1492 | ++$self->{cursor} if $self->{cursor} < length $self->{text}; |
1492 | ++$self->{cursor} if $self->{cursor} < length $self->{text}; |
1493 | } elsif ($sym == CFClient::SDLK_HOME) { |
1493 | } elsif ($sym == CFClient::SDLK_HOME) { |
1494 | $self->{cursor} = 0; |
1494 | $self->{cursor} = 0; |
1495 | } elsif ($sym == CFClient::SDLK_END) { |
1495 | } elsif ($sym == CFClient::SDLK_END) { |
1496 | $self->{cursor} = length $text; |
1496 | $self->{cursor} = length $text; |
1497 | } elsif ($sym == 27) { |
1497 | } elsif ($uni == 27) { |
1498 | $self->emit ('escape'); |
1498 | $self->emit ('escape'); |
1499 | } elsif ($uni) { |
1499 | } elsif ($uni) { |
1500 | substr $text, $self->{cursor}++, 0, chr $uni; |
1500 | substr $text, $self->{cursor}++, 0, chr $uni; |
1501 | } |
1501 | } |
1502 | |
1502 | |