All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Hord <phil.hord@gmail.com>
To: Timothy Madden <terminatorul@gmail.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: Wrong tabs in terminal output for git diff
Date: Sat, 12 Jun 2021 16:10:04 -0700	[thread overview]
Message-ID: <CABURp0pUDtKEDcFx+Yh3hZRXnHOzUxiOEU=epBz3SB1O5e2HqA@mail.gmail.com> (raw)
In-Reply-To: <8d3f8cf4-24ec-1271-ccd3-70db24f53523@gmail.com>

On Fri, Jun 11, 2021 at 12:30 PM Timothy Madden <terminatorul@gmail.com> wrote:
> For git diff and git show commands, terminal output appears with wrong
> tab stops (missaligned).
>
> Because diff operation inserts a new column at character position 1, for
> the +, - and space characters, the diff content appears shifted to the
> right by 1 column. But not the tab stop positions. So relative to the
> text, the tab stops now appear off-by-one (shifted to the left).

I think "fixing" this would require modifying the diff output so it
would no longer be correct. If we accept that a switch can make a
incorrect diff for display only, though, it seems something could be
done here.

I think the only approach that can fix the alignment, however, is to
remove the +/- prefix markers altogether.  We do this now with the
`--color-words` switch. This kind of solution only works if there is
some way to indicate added/removed lines other than the line-prefix
marker; ANSI color codes, for example.  Would that work for your
needs, or were you thinking of something else?

  parent reply	other threads:[~2021-06-12 23:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 19:25 Wrong tabs in terminal output for git diff Timothy Madden
2021-06-11 21:08 ` Felipe Contreras
2021-06-12 23:10 ` Phil Hord [this message]
2021-06-13  4:04   ` Jeff King
2021-06-14  1:26     ` Junio C Hamano

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='CABURp0pUDtKEDcFx+Yh3hZRXnHOzUxiOEU=epBz3SB1O5e2HqA@mail.gmail.com' \
    --to=phil.hord@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=terminatorul@gmail.com \
    /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.