Skip to content
Snippets Groups Projects
Commit 01a69660 authored by Phillip Wood's avatar Phillip Wood Committed by Junio C Hamano
Browse files

add -p: only display help for active keys


If the user presses a key that add -p wasn't expecting then it prints
a list of key bindings. Although the prompt only lists the active
bindings the help was printed for all bindings.  Fix this by using the
list of keys in the prompt to filter the help. Note that the list of
keys was already passed to help_patch_cmd() by the caller so there is
no change needed to the call site.

Signed-off-by: default avatarPhillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 5be1f00a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1184,7 +1184,13 @@ d - do not apply this hunk or any of the later hunks in the file"),
);
 
sub help_patch_cmd {
print colored $help_color, __($help_patch_modes{$patch_mode}), "\n", __ <<EOF ;
local $_;
my $other = $_[0] . ",/,?";
print colored $help_color, __($help_patch_modes{$patch_mode}), "\n",
map { "$_\n" } grep {
my $c = quotemeta(substr($_, 0, 1));
$other =~ /,$c/
} split "\n", __ <<EOF ;
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment