… | |
… | |
1469 | |
1469 | |
1470 | if ($sym == 13) { |
1470 | if ($sym == 13) { |
1471 | unshift @{$self->{history}}, |
1471 | unshift @{$self->{history}}, |
1472 | my $txt = $self->get_text; |
1472 | my $txt = $self->get_text; |
1473 | $self->{history_pointer} = -1; |
1473 | $self->{history_pointer} = -1; |
|
|
1474 | $self->{history_saveback} = ''; |
1474 | $self->emit (activate => $txt); |
1475 | $self->emit (activate => $txt); |
1475 | $self->update; |
1476 | $self->update; |
1476 | |
1477 | |
1477 | } elsif ($sym == CFClient::SDLK_UP) { |
1478 | } elsif ($sym == CFClient::SDLK_UP) { |
1478 | if ($self->{history_pointer} < 0) { |
1479 | if ($self->{history_pointer} < 0) { |
1479 | $self->{history_saveback} = $self->get_text; |
1480 | $self->{history_saveback} = $self->get_text; |
1480 | } |
1481 | } |
|
|
1482 | if (@{$self->{history} || []} > 0) { |
1481 | $self->{history_pointer}++; |
1483 | $self->{history_pointer}++; |
1482 | if ($self->{history_pointer} >= @{$self->{history} || []}) { |
1484 | if ($self->{history_pointer} >= @{$self->{history} || []}) { |
1483 | $self->{history_pointer} = @{$self->{history} || []} - 1; |
1485 | $self->{history_pointer} = @{$self->{history} || []} - 1; |
|
|
1486 | } |
|
|
1487 | $self->set_text ($self->{history}->[$self->{history_pointer}]); |
1484 | } |
1488 | } |
1485 | $self->set_text ($self->{history}->[$self->{history_pointer}]); |
|
|
1486 | |
1489 | |
1487 | } elsif ($sym == CFClient::SDLK_DOWN) { |
1490 | } elsif ($sym == CFClient::SDLK_DOWN) { |
1488 | $self->{history_pointer}--; |
1491 | $self->{history_pointer}--; |
1489 | $self->{history_pointer} = -1 if $self->{history_pointer} < 0; |
1492 | $self->{history_pointer} = -1 if $self->{history_pointer} < 0; |
1490 | |
1493 | |