X-Git-Url: https://ruderich.org/simon/gitweb/?p=fcscs%2Ffcscs.git;a=blobdiff_plain;f=bin%2Ffcscs;h=8cffebd6ff049e78dbcc54f0ae2634e4747e89e0;hp=e2a89b71b3d649fc9af254b3c1e0571cf129eee2;hb=76b007353b400f22976e39da57db988a82c8eca8;hpb=82bb39f14f34fef9b08d1c11c1c7704a71d590cb diff --git a/bin/fcscs b/bin/fcscs index e2a89b7..8cffebd 100755 --- a/bin/fcscs +++ b/bin/fcscs @@ -1034,6 +1034,7 @@ Used as mappings, see L above. Used as handler to yank, paste selection or open URL in browser. + debug() get_regex_matches() select_match() run_command() @@ -1066,6 +1067,8 @@ package Fcscs { sub handler_paste { return main::handler_paste(@_); } sub handler_url { return main::handler_url(@_); } + sub debug { return main::debug(@_); } + sub get_regex_matches { return main::get_regex_matches(@_); } sub select_match { return main::select_match(@_); } @@ -1211,10 +1214,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; }