{"thread":{"id":"24729","subject":"[PATCH] Highlight every 5th line for add -i","startedAt":"2010-08-13T12:46:09Z","lastAt":"2010-08-14T18:58:13Z","messageCount":3,"participants":["Ciaran McCreesh","Stephen Boyd"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"147999","messageId":"1281703569-8833-1-git-send-email-ciaran.mccreesh@googlemail.com","threadId":"24729","inReplyTo":null,"subject":"[PATCH] Highlight every 5th line for add -i","fromName":"Ciaran McCreesh","fromEmail":"ciaran.mccreesh@googlemail.com","sentAt":"2010-08-13T12:46:09Z","receivedAt":"2010-08-13T12:46:09Z","isPatch":true,"sender":{"key":"ciaran.mccreesh@googlemail.com","avatar":"https://gravatar.com/avatar/2b6d636bccfecedc57b9980bd56beb13679184f4b26bc7239b166ed93e9b210e?d=mp&s=160"},"body":"It's easier to match up numbers to filenames when there's lots of output\nthat way.\n---\n git-add--interactive.perl |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex 27fc793..542c29c 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -498,6 +498,7 @@ sub list_and_choose {\n \t\t\tmy $ref = ref $print;\n \t\t\tmy $highlighted = highlight_prefix(@{$prefixes[$i]})\n \t\t\t    if @prefixes;\n+\t\t\tmy $this_line_color = '';\n \t\t\tif ($ref eq 'ARRAY') {\n \t\t\t\t$print = $highlighted || $print->[0];\n \t\t\t}\n@@ -511,7 +512,10 @@ sub list_and_choose {\n \t\t\telse {\n \t\t\t\t$print = $highlighted || $print;\n \t\t\t}\n-\t\t\tprintf(\"%s%2d: %s\", $chosen, $i+1, $print);\n+\t\t\tif ((! $opts->{LIST_FLAT}) && (($i + 1) % 5 == 0) && (@stuff >= 10)) {\n+\t\t\t\t$this_line_color = $header_color;\n+\t\t\t}\n+\t\t\tprintf(\"%s%s%2d: %s%s\", $chosen, $this_line_color, $i+1, $print, $normal_color);\n \t\t\tif (($opts->{LIST_FLAT}) &&\n \t\t\t    (($i + 1) % ($opts->{LIST_FLAT}))) {\n \t\t\t\tprint \"\\t\";\n-- \n1.7.2\n"},{"id":"148080","messageId":"4C6670FD.9010100@gmail.com","threadId":"24729","inReplyTo":"1281703569-8833-1-git-send-email-ciaran.mccreesh@googlemail.com","subject":"Re: [PATCH] Highlight every 5th line for add -i","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-08-14T10:33:33Z","receivedAt":"2010-08-14T10:33:33Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"  On 08/13/2010 05:46 AM, Ciaran McCreesh wrote:\n> It's easier to match up numbers to filenames when there's lots of output\n> that way.\n\nInteresting. Maybe it would be better to reorganize the listing so that the number is adjacent to the path name? For example:\n\n    staged    unstaged   #  path\nunchanged     +5/-2     1: git-add--interactive.perl\nunchanged     +100/-2   2: builtin/log.c\nunchanged     +49/-2    3: builtin/add.c\nunchanged     +0/-60    4: git.c\nunchanged     +5/-2     5: help.c\n\nI'm mostly concerned that the highlighting (boldening?) is going to be confused with selection.\n\nPatch below (I'm sure someone more versed in perl can do it better).\n\n--->8----8<---\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex 27fc793..002122d 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -225,8 +225,8 @@ sub list_untracked {\n         run_cmd_pipe(qw(git ls-files --others --exclude-standard --), @ARGV);\n  }\n\n-my $status_fmt = '%12s %12s %s';\n-my $status_head = sprintf($status_fmt, 'staged', 'unstaged', 'path');\n+my $status_fmt = '%12s %12s %4s%s %s';\n+my $status_head = sprintf($status_fmt, 'staged', 'unstaged', '#', ' ', 'path');\n\n  {\n         my $initial;\n@@ -488,7 +488,7 @@ sub list_and_choose {\n\n                 if ($opts->{HEADER}) {\n                         if (!$opts->{LIST_FLAT}) {\n-                               print \"     \";\n+                               print \" \";\n                         }\n                         print colored $header_color, \"$opts->{HEADER}\\n\";\n                 }\n@@ -506,12 +506,14 @@ sub list_and_choose {\n                                 $print = sprintf($status_fmt,\n                                     $print->{INDEX},\n                                     $print->{FILE},\n+                                   $i + 1,\n+                                   \":\",\n                                     $value);\n                         }\n                         else {\n                                 $print = $highlighted || $print;\n                         }\n-                       printf(\"%s%2d: %s\", $chosen, $i+1, $print);\n+                       printf(\"%s%s\", $chosen, $print);\n                         if (($opts->{LIST_FLAT})&&\n                             (($i + 1) % ($opts->{LIST_FLAT}))) {\n                                 print \"\\t\";\n"},{"id":"148100","messageId":"20100814195813.2ef163ef@snowcone","threadId":"24729","inReplyTo":"4C6670FD.9010100@gmail.com","subject":"Re: [PATCH] Highlight every 5th line for add -i","fromName":"Ciaran McCreesh","fromEmail":"ciaran.mccreesh@googlemail.com","sentAt":"2010-08-14T18:58:13Z","receivedAt":"2010-08-14T18:58:13Z","isPatch":true,"sender":{"key":"ciaran.mccreesh@googlemail.com","avatar":"https://gravatar.com/avatar/2b6d636bccfecedc57b9980bd56beb13679184f4b26bc7239b166ed93e9b210e?d=mp&s=160"},"body":"On Sat, 14 Aug 2010 03:33:33 -0700\nStephen Boyd <bebarino@gmail.com> wrote:\n>   On 08/13/2010 05:46 AM, Ciaran McCreesh wrote:\n> > It's easier to match up numbers to filenames when there's lots of\n> > output that way.\n> \n> Interesting. Maybe it would be better to reorganize the listing so\n> that the number is adjacent to the path name? For example:\n> \n>     staged    unstaged   #  path\n> unchanged     +5/-2     1: git-add--interactive.perl\n> unchanged     +100/-2   2: builtin/log.c\n> unchanged     +49/-2    3: builtin/add.c\n> unchanged     +0/-60    4: git.c\n> unchanged     +5/-2     5: help.c\n> \n> I'm mostly concerned that the highlighting (boldening?) is going to\n> be confused with selection.\n\nThat's also good for me. I don't have any particular preference or\nopinions on which is clearer.\n\n-- \nCiaran McCreesh\n"}]}