* [PATCH 1/2] git-add--interactive: Allow Ctrl-D to exit
@ 2007-09-26 13:56 Jean-Luc Herren
0 siblings, 0 replies; only message in thread
From: Jean-Luc Herren @ 2007-09-26 13:56 UTC (permalink / raw)
To: git; +Cc: gitster
Hitting Ctrl-D (EOF) is a common way to exit shell-like tools.
When in a sub-menu it will still behave as if an empty line had
been entered, carrying out the action on the selected items and
returning to the previous menu.
Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
---
git-add--interactive.perl | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 7921cde..f9e9f02 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -213,7 +213,11 @@ sub list_and_choose {
print ">> ";
}
my $line = <STDIN>;
- last if (!$line);
+ if (!$line) {
+ print "\n";
+ $opts->{ON_EOF}->() if $opts->{ON_EOF};
+ last;
+ }
chomp $line;
my $donesomething = 0;
for my $choice (split(/[\s,]+/, $line)) {
@@ -791,6 +795,7 @@ sub main_loop {
SINGLETON => 1,
LIST_FLAT => 4,
HEADER => '*** Commands ***',
+ ON_EOF => \&quit_cmd,
IMMEDIATE => 1 }, @cmd);
if ($it) {
eval {
--
1.5.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-26 14:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26 13:56 [PATCH 1/2] git-add--interactive: Allow Ctrl-D to exit Jean-Luc Herren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).