Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15
STALE3739d

[PATCH] Highlight every 5th line for add -i

From: Ciaran McCreesh <hidden>
Date: 2016-06-15 22:49:18
Subsystem: the rest · Maintainer: Linus Torvalds

It's easier to match up numbers to filenames when there's lots of output
that way.
---
 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 27fc793..542c29c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,6 +498,7 @@ sub list_and_choose {
 			my $ref = ref $print;
 			my $highlighted = highlight_prefix(@{$prefixes[$i]})
 			    if @prefixes;
+			my $this_line_color = '';
 			if ($ref eq 'ARRAY') {
 				$print = $highlighted || $print->[0];
 			}
@@ -511,7 +512,10 @@ sub list_and_choose {
 			else {
 				$print = $highlighted || $print;
 			}
-			printf("%s%2d: %s", $chosen, $i+1, $print);
+			if ((! $opts->{LIST_FLAT}) && (($i + 1) % 5 == 0) && (@stuff >= 10)) {
+				$this_line_color = $header_color;
+			}
+			printf("%s%s%2d: %s%s", $chosen, $this_line_color, $i+1, $print, $normal_color);
 			if (($opts->{LIST_FLAT}) &&
 			    (($i + 1) % ($opts->{LIST_FLAT}))) {
 				print "\t";
-- 
1.7.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help