git-send-email: Better handling of EOF
Before, when the user sent the EOF control character, the prompts would be repeated on the same line as the previous prompt. Now, repeat prompts display on separate lines. Signed-off-by: Michael Witten <mfwitten@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Witten committed
Feb 3, 2008 at 19:53 UTC
8a7c56e1591ad5593883bb23fb6c5683a8a1a1a8
1 file changed
+28
-16
git-send-email.perl
+28
-16
@@ -376,9 +376,12 @@ if (@files) {
376
my $prompting = 0;
377
if (!defined $sender) {
378
$sender = $repoauthor || $repocommitter;
379
- do {
379
+
380
+ while (1) {
381
$_ = $term->readline("Who should the emails appear to be from? [$sender] ");
381
- } while (!defined $_);
382
+ last if defined $_;
383
+ print "\n";
384
+ }
385
386
$sender = $_ if ($_);
387
print "Emails will be sent from: ", $sender, "\n";
@@ -386,10 +389,14 @@ if (!defined $sender) {
389
}
390
391
if (!@to) {
389
- do {
390
- $_ = $term->readline("Who should the emails be sent to? ",
391
- "");
392
- } while (!defined $_);
392
+
393
+
394
+ while (1) {
395
+ $_ = $term->readline("Who should the emails be sent to? ", "");
396
+ last if defined $_;
397
+ print "\n";
398
+ }
399
+
400
my $to = $_;
401
push @to, split /,/, $to;
402
$prompting++;
@@ -411,19 +418,22 @@ sub expand_aliases {
418
@bcclist = expand_aliases(@bcclist);
419
420
if (!defined $initial_subject && $compose) {
414
- do {
415
- $_ = $term->readline("What subject should the initial email start with? ",
416
- $initial_subject);
417
- } while (!defined $_);
421
+ while (1) {
422
+ $_ = $term->readline("What subject should the initial email start with? ", $initial_subject);
423
+ last if defined $_;
424
+ print "\n";
425
+ }
426
+
427
$initial_subject = $_;
428
$prompting++;
429
}
430
431
if ($thread && !defined $initial_reply_to && $prompting) {
423
- do {
424
- $_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
425
- $initial_reply_to);
426
- } while (!defined $_);
432
+ while (1) {
433
+ $_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ", $initial_reply_to);
434
+ last if defined $_;
435
+ print "\n";
436
+ }
437
438
$initial_reply_to = $_;
439
}
@@ -474,9 +484,11 @@ EOT
484
close(C);
485
close(C2);
486
477
- do {
487
+ while (1) {
488
$_ = $term->readline("Send this email? (y|n) ");
479
- } while (!defined $_);
489
+ last if defined $_;
490
+ print "\n";
491
+ }
492
493
if (uc substr($_,0,1) ne 'Y') {
494
cleanup_compose_files();