… | |
… | |
246 | } |
246 | } |
247 | |
247 | |
248 | # return top left coordinates |
248 | # return top left coordinates |
249 | sub _topleft { |
249 | sub _topleft { |
250 | my ($self, $x, $y) = @_; |
250 | my ($self, $x, $y) = @_; |
|
|
251 | |
|
|
252 | $self->{parent} |
|
|
253 | or Carp::confess "no parent widget in _topleft\n";#d# |
251 | |
254 | |
252 | $self->{parent}->_topleft ($x + $self->{x}, $y + $self->{y}); |
255 | $self->{parent}->_topleft ($x + $self->{x}, $y + $self->{y}); |
253 | } |
256 | } |
254 | |
257 | |
255 | # translate global coordinates to local coordinate system |
258 | # translate global coordinates to local coordinate system |
… | |
… | |
1469 | |
1472 | |
1470 | if ($sym == 13) { |
1473 | if ($sym == 13) { |
1471 | unshift @{$self->{history}}, |
1474 | unshift @{$self->{history}}, |
1472 | my $txt = $self->get_text; |
1475 | my $txt = $self->get_text; |
1473 | $self->{history_pointer} = -1; |
1476 | $self->{history_pointer} = -1; |
|
|
1477 | $self->{history_saveback} = ''; |
1474 | $self->emit (activate => $txt); |
1478 | $self->emit (activate => $txt); |
1475 | $self->update; |
1479 | $self->update; |
1476 | |
1480 | |
1477 | } elsif ($sym == CFClient::SDLK_UP) { |
1481 | } elsif ($sym == CFClient::SDLK_UP) { |
1478 | if ($self->{history_pointer} < 0) { |
1482 | if ($self->{history_pointer} < 0) { |
1479 | $self->{history_saveback} = $self->get_text; |
1483 | $self->{history_saveback} = $self->get_text; |
1480 | } |
1484 | } |
|
|
1485 | if (@{$self->{history} || []} > 0) { |
1481 | $self->{history_pointer}++; |
1486 | $self->{history_pointer}++; |
1482 | if ($self->{history_pointer} >= @{$self->{history}}) { |
1487 | if ($self->{history_pointer} >= @{$self->{history} || []}) { |
1483 | $self->{history_pointer} = @{$self->{history}} - 1; |
1488 | $self->{history_pointer} = @{$self->{history} || []} - 1; |
|
|
1489 | } |
|
|
1490 | $self->set_text ($self->{history}->[$self->{history_pointer}]); |
1484 | } |
1491 | } |
1485 | $self->set_text ($self->{history}->[$self->{history_pointer}]); |
|
|
1486 | |
1492 | |
1487 | } elsif ($sym == CFClient::SDLK_DOWN) { |
1493 | } elsif ($sym == CFClient::SDLK_DOWN) { |
1488 | $self->{history_pointer}--; |
1494 | $self->{history_pointer}--; |
1489 | $self->{history_pointer} = -1 if $self->{history_pointer} < 0; |
1495 | $self->{history_pointer} = -1 if $self->{history_pointer} < 0; |
1490 | |
1496 | |