… | |
… | |
514 | ); |
514 | ); |
515 | |
515 | |
516 | sub emit { |
516 | sub emit { |
517 | my ($self, $signal, @args) = @_; |
517 | my ($self, $signal, @args) = @_; |
518 | |
518 | |
519 | # I do not really like this solution, but I dislike duplication |
519 | # I do not really like this solution, but I do not like duplication |
520 | # and needlessly verbose code, too. |
520 | # and needlessly verbose code, either. |
521 | my @append |
521 | my @append |
522 | = $has_coords{$signal} |
522 | = $has_coords{$signal} |
523 | ? $args[0]->xy ($self) |
523 | ? $args[0]->xy ($self) |
524 | : (); |
524 | : (); |
525 | |
525 | |
… | |
… | |
1971 | } elsif ($uni == 21) { # ctrl-u |
1971 | } elsif ($uni == 21) { # ctrl-u |
1972 | $text = ""; |
1972 | $text = ""; |
1973 | $self->{cursor} = 0; |
1973 | $self->{cursor} = 0; |
1974 | } elsif ($uni == 27) { |
1974 | } elsif ($uni == 27) { |
1975 | $self->emit ('escape'); |
1975 | $self->emit ('escape'); |
1976 | } elsif ($uni) { |
1976 | } elsif ($uni >= 0x20) { |
1977 | substr $text, $self->{cursor}++, 0, chr $uni; |
1977 | substr $text, $self->{cursor}++, 0, chr $uni; |
1978 | } else { |
1978 | } else { |
1979 | return 0; |
1979 | return 0; |
1980 | } |
1980 | } |
1981 | |
1981 | |
… | |
… | |
3827 | if ($ev->{button} == 1) { |
3827 | if ($ev->{button} == 1) { |
3828 | $::CONN->user_send ("cast $spell->{name}"); |
3828 | $::CONN->user_send ("cast $spell->{name}"); |
3829 | } elsif ($ev->{button} == 2) { |
3829 | } elsif ($ev->{button} == 2) { |
3830 | $::CONN->user_send ("invoke $spell->{name}"); |
3830 | $::CONN->user_send ("invoke $spell->{name}"); |
3831 | } elsif ($ev->{button} == 3) { |
3831 | } elsif ($ev->{button} == 3) { |
|
|
3832 | my $shortname = CFPlus::shorten $spell->{name}, 14; |
3832 | (new CFPlus::UI::Menu |
3833 | (new CFPlus::UI::Menu |
3833 | items => [ |
3834 | items => [ |
3834 | ["bind <i>cast $spell->{name}</i> to a key" => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }], |
3835 | ["bind <i>cast $shortname</i> to a key" => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }], |
3835 | ["bind <i>invoke $spell->{name}</i> to a key" => sub { $::BIND_EDITOR->do_quick_binding (["invoke $spell->{name}"]) }], |
3836 | ["bind <i>invoke $shortname</i> to a key" => sub { $::BIND_EDITOR->do_quick_binding (["invoke $spell->{name}"]) }], |
3836 | ], |
3837 | ], |
3837 | )->popup ($ev); |
3838 | )->popup ($ev); |
3838 | } else { |
3839 | } else { |
3839 | return 0; |
3840 | return 0; |
3840 | } |
3841 | } |