--- deliantra/Deliantra-Client/DC/Macro.pm 2006/12/09 21:44:43 1.2 +++ deliantra/Deliantra-Client/DC/Macro.pm 2006/12/09 22:28:11 1.4 @@ -159,20 +159,17 @@ } # find macro by event -# maybe return multiple results? sub match_event($) { my ($ev) = @_; - for my $macro (@{ $::PROFILE->{macro} || [] }) { - my $key = $macro->{accelkey} - or next; - - $key->[1] == $ev->{sym} - && $key->[0] == ($ev->{mod} & $MODIFIER_MASK) - && return $macro; - } - - () + grep { + if (my $key = $_->{accelkey}) { + $key->[1] == $ev->{sym} + && $key->[0] == ($ev->{mod} & $MODIFIER_MASK) + } else { + 0 + } + } @{ $::PROFILE->{macro} || [] } } sub keyboard_setup { @@ -340,7 +337,7 @@ ); $macros->add (1, $y, new CFPlus::UI::Label - text => (join "; ", @{ $macro->{action} }), + text => (join "; ", @{ $macro->{action} || [] }), tooltip => $tooltip_commands . $tooltip_common, expand => 1, ellipsise => 3, @@ -359,14 +356,13 @@ # this is a shortcut method that asks for a binding # and then just binds it. sub quick_macro { - my ($self, $cmds, $end_cb) = @_; + my ($cmds, $end_cb) = @_; my $macro = { action => $cmds, }; trigger_edit $macro, sub { - if ($_[0]) { push @{ $::PROFILE->{macro} }, $macro; $REFRESH_MACRO_LIST->();