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
This commit is contained in:
commit
7d53ff402a
@ -1175,6 +1175,7 @@ sub prompt_single_character {
|
|||||||
ReadMode 'cbreak';
|
ReadMode 'cbreak';
|
||||||
my $key = ReadKey 0;
|
my $key = ReadKey 0;
|
||||||
ReadMode 'restore';
|
ReadMode 'restore';
|
||||||
|
if (defined $key) {
|
||||||
if ($use_termcap and $key eq "\e") {
|
if ($use_termcap and $key eq "\e") {
|
||||||
while (!defined $term_escapes{$key}) {
|
while (!defined $term_escapes{$key}) {
|
||||||
my $next = ReadKey 0.5;
|
my $next = ReadKey 0.5;
|
||||||
@ -1183,7 +1184,8 @@ sub prompt_single_character {
|
|||||||
}
|
}
|
||||||
$key =~ s/\e/^[/;
|
$key =~ s/\e/^[/;
|
||||||
}
|
}
|
||||||
print "$key" if defined $key;
|
print "$key";
|
||||||
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
return $key;
|
return $key;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user