support $match->{handler} to overwrite handler for certain matches
authorSimon Ruderich <simon@ruderich.org>
Sat, 23 Jan 2016 23:42:18 +0000 (00:42 +0100)
committerSimon Ruderich <simon@ruderich.org>
Sat, 23 Jan 2016 23:42:18 +0000 (00:42 +0100)
E.g. a different handler for YouTube URLs to automatically download the
video.

bin/fcscs

index e2a89b71b3d649fc9af254b3c1e0571cf129eee2..9c33fe95ca06d3c9f7bcc05e261d620af02923d4 100755 (executable)
--- a/bin/fcscs
+++ b/bin/fcscs
@@ -1212,6 +1212,7 @@ RESULT:
 
             debug \%config, 'input', 'running handler';
             my $handler = $config{state}{handler};                 # set by user
+            $handler = $result->{match}->{handler} unless defined $handler; # set by match
             $handler = $result->{handler} unless defined $handler; # set by mapping
             $handler = $config{handler}{yank} unless defined $handler; # fallback
             $handler->($screen, \%config, $result->{match});