git-add--interactive: Allow Ctrl-D to exit
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									552ce11006
								
							
						
					
					
						commit
						c95c02486c
					
				|  | @ -213,7 +213,11 @@ sub list_and_choose { | ||||||
| 			print ">> "; | 			print ">> "; | ||||||
| 		} | 		} | ||||||
| 		my $line = <STDIN>; | 		my $line = <STDIN>; | ||||||
| 		last if (!$line); | 		if (!$line) { | ||||||
|  | 			print "\n"; | ||||||
|  | 			$opts->{ON_EOF}->() if $opts->{ON_EOF}; | ||||||
|  | 			last; | ||||||
|  | 		} | ||||||
| 		chomp $line; | 		chomp $line; | ||||||
| 		my $donesomething = 0; | 		my $donesomething = 0; | ||||||
| 		for my $choice (split(/[\s,]+/, $line)) { | 		for my $choice (split(/[\s,]+/, $line)) { | ||||||
|  | @ -791,6 +795,7 @@ sub main_loop { | ||||||
| 					     SINGLETON => 1, | 					     SINGLETON => 1, | ||||||
| 					     LIST_FLAT => 4, | 					     LIST_FLAT => 4, | ||||||
| 					     HEADER => '*** Commands ***', | 					     HEADER => '*** Commands ***', | ||||||
|  | 					     ON_EOF => \&quit_cmd, | ||||||
| 					     IMMEDIATE => 1 }, @cmd); | 					     IMMEDIATE => 1 }, @cmd); | ||||||
| 		if ($it) { | 		if ($it) { | ||||||
| 			eval { | 			eval { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Jean-Luc Herren
						Jean-Luc Herren