Browse Source

Merge branch 'cb/add-p-single-key-fix'

The single-key-input mode in "git add -p" had some code to handle
keys that generate a sequence of input via ReadKey(), which did not
handle end-of-file correctly, which has been fixed.

* cb/add-p-single-key-fix:
  add -p: avoid use of undefined $key when ReadKey -> EOF
maint
Junio C Hamano 3 years ago
parent
commit
7d53ff402a
  1. 4
      git-add--interactive.perl

4
git-add--interactive.perl

@ -1175,6 +1175,7 @@ sub prompt_single_character { @@ -1175,6 +1175,7 @@ sub prompt_single_character {
ReadMode 'cbreak';
my $key = ReadKey 0;
ReadMode 'restore';
if (defined $key) {
if ($use_termcap and $key eq "\e") {
while (!defined $term_escapes{$key}) {
my $next = ReadKey 0.5;
@ -1183,7 +1184,8 @@ sub prompt_single_character { @@ -1183,7 +1184,8 @@ sub prompt_single_character {
}
$key =~ s/\e/^[/;
}
print "$key" if defined $key;
print "$key";
}
print "\n";
return $key;
} else {

Loading…
Cancel
Save