All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <bebarino@gmail.com>
To: Ciaran McCreesh <ciaran.mccreesh@googlemail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Highlight every 5th line for add -i
Date: Sat, 14 Aug 2010 03:33:33 -0700	[thread overview]
Message-ID: <4C6670FD.9010100@gmail.com> (raw)
In-Reply-To: <1281703569-8833-1-git-send-email-ciaran.mccreesh@googlemail.com>

  On 08/13/2010 05:46 AM, Ciaran McCreesh wrote:
> It's easier to match up numbers to filenames when there's lots of output
> that way.

Interesting. Maybe it would be better to reorganize the listing so that the number is adjacent to the path name? For example:

    staged    unstaged   #  path
unchanged     +5/-2     1: git-add--interactive.perl
unchanged     +100/-2   2: builtin/log.c
unchanged     +49/-2    3: builtin/add.c
unchanged     +0/-60    4: git.c
unchanged     +5/-2     5: help.c

I'm mostly concerned that the highlighting (boldening?) is going to be confused with selection.

Patch below (I'm sure someone more versed in perl can do it better).

--->8----8<---

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 27fc793..002122d 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -225,8 +225,8 @@ sub list_untracked {
         run_cmd_pipe(qw(git ls-files --others --exclude-standard --), @ARGV);
  }

-my $status_fmt = '%12s %12s %s';
-my $status_head = sprintf($status_fmt, 'staged', 'unstaged', 'path');
+my $status_fmt = '%12s %12s %4s%s %s';
+my $status_head = sprintf($status_fmt, 'staged', 'unstaged', '#', ' ', 'path');

  {
         my $initial;
@@ -488,7 +488,7 @@ sub list_and_choose {

                 if ($opts->{HEADER}) {
                         if (!$opts->{LIST_FLAT}) {
-                               print "     ";
+                               print " ";
                         }
                         print colored $header_color, "$opts->{HEADER}\n";
                 }
@@ -506,12 +506,14 @@ sub list_and_choose {
                                 $print = sprintf($status_fmt,
                                     $print->{INDEX},
                                     $print->{FILE},
+                                   $i + 1,
+                                   ":",
                                     $value);
                         }
                         else {
                                 $print = $highlighted || $print;
                         }
-                       printf("%s%2d: %s", $chosen, $i+1, $print);
+                       printf("%s%s", $chosen, $print);
                         if (($opts->{LIST_FLAT})&&
                             (($i + 1) % ($opts->{LIST_FLAT}))) {
                                 print "\t";

  reply	other threads:[~2010-08-14 10:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13 12:46 [PATCH] Highlight every 5th line for add -i Ciaran McCreesh
2010-08-14 10:33 ` Stephen Boyd [this message]
2010-08-14 18:58   ` Ciaran McCreesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C6670FD.9010100@gmail.com \
    --to=bebarino@gmail.com \
    --cc=ciaran.mccreesh@googlemail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.