Git development
 help / color / mirror / Atom feed
* [PATCH/RFC] git-add--interactive.perl: Answer questions with a single keypress
@ 2008-11-05  6:15 Suraj N. Kurapati
  2008-11-05  6:31 ` [PATCH/RFC v2] " Suraj N. Kurapati
  2008-11-05 17:59 ` [PATCH/RFC v3] git add -i: " Suraj N. Kurapati
  0 siblings, 2 replies; 8+ messages in thread
From: Suraj N. Kurapati @ 2008-11-05  6:15 UTC (permalink / raw)
  To: git

From aef6df163b90b9485da1f97a14ffab6d8de9b047 Mon Sep 17 00:00:00 2001
From: Suraj N. Kurapati <sunaku@gmail.com>
Date: Tue, 4 Nov 2008 20:32:34 -0800
Subject: [PATCH] git-add--interactive.perl: Answer questions with a single keypress

Allows the user to answer 'Stage this hunk' questions with a
single keypress, just like in Darcs.  Previously, the user
was forced to press the Return key after every choice, which
quickly becomes tiring and burdensome work for the fingers.

Signed-off-by: Suraj N. Kurapati <sunaku@gmail.com>
---
 git-add--interactive.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index b0223c3..1a22968 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -877,6 +877,7 @@ sub patch_update_file {
 	$num = scalar @hunk;
 	$ix = 0;
 
+	require Term::ReadKey;
 	while (1) {
 		my ($prev, $next, $other, $undecided, $i);
 		$other = '';
@@ -920,7 +921,10 @@ sub patch_update_file {
 			print;
 		}
 		print colored $prompt_color, "Stage this hunk [y/n/a/d$other/?]? ";
-		my $line = <STDIN>;
+
+		Term::ReadKey::ReadMode('raw');
+		my $line = Term::ReadKey::ReadKey(0);
+		Term::ReadKey::ReadMode('restore');
 		if ($line) {
 			if ($line =~ /^y/i) {
 				$hunk[$ix]{USE} = 1;
-- 
1.6.0.3

\0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-11-07 19:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-05  6:15 [PATCH/RFC] git-add--interactive.perl: Answer questions with a single keypress Suraj N. Kurapati
2008-11-05  6:31 ` [PATCH/RFC v2] " Suraj N. Kurapati
2008-11-05 17:59 ` [PATCH/RFC v3] git add -i: " Suraj N. Kurapati
2008-11-06  8:42   ` Jeff King
2008-11-06 16:15     ` Suraj N. Kurapati
2008-11-06 17:06       ` Junio C Hamano
2008-11-07 19:19         ` Jeff King
2008-11-07 19:19       ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox