X-Git-Url: https://ruderich.org/simon/gitweb/?p=fcscs%2Ffcscs.git;a=blobdiff_plain;f=bin%2Ffcscs;h=8a040f84f3d29624c5cdff96979281fa69d9f9d4;hp=e2a89b71b3d649fc9af254b3c1e0571cf129eee2;hb=14126138d777250aac6d90b43f1a271bba91a820;hpb=82bb39f14f34fef9b08d1c11c1c7704a71d590cb diff --git a/bin/fcscs b/bin/fcscs index e2a89b7..8a040f8 100755 --- a/bin/fcscs +++ b/bin/fcscs @@ -1211,10 +1211,20 @@ RESULT: } debug \%config, 'input', 'running handler'; - my $handler = $config{state}{handler}; # set by user - $handler = $result->{handler} unless defined $handler; # set by mapping - $handler = $config{handler}{yank} unless defined $handler; # fallback - $handler->($screen, \%config, $result->{match}); + + # Choose handler with falling priority. + my @handlers = ( + $config{state}{handler}, # set by user + $result->{match}->{handler}, # set by match + $result->{handler}, # set by mapping + $config{handler}{yank}, # fallback + ); + foreach my $handler (@handlers) { + next unless defined $handler; + + $handler->($screen, \%config, $result->{match}); + last; + } last; }