public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Chris Idema <github_chris_idema@proton.me>
Cc: Chris Idema via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v4] git-gui: shift tabstops to account for the first column of context diffs
Date: Thu, 29 Jan 2026 22:36:20 +0100	[thread overview]
Message-ID: <191b6fe4-e273-4ecd-9b73-725c2dff4306@kdbg.org> (raw)
In-Reply-To: <pull.2179.v4.git.git.1769684944593.gitgitgadget@gmail.com>

Am 29.01.26 um 12:09 schrieb Chris Idema via GitGitGadget:
> From: Chris Idema <github_chris_idema@proton.me>
> 
> When reviewing a file before staging you want its content aligned using
> gui.tabsize. The prefixing of lines with +, - or space characters should
> not change this alignment. In gitk this is done correctly. In Git Gui not.
> 
> Signed-off-by: Chris Idema <github_chris_idema@proton.me>
> ---

> 
>  git-gui/lib/diff.tcl | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
> index 442737ba4f..8be1a613fb 100644
> --- a/git-gui/lib/diff.tcl
> +++ b/git-gui/lib/diff.tcl
> @@ -385,6 +385,8 @@ proc read_diff {fd conflict_size cont_info} {
>  		#
>  		if {[string match {@@@ *} $line]} {
>  			set is_3way_diff 1
> +			apply_tab_size 2
> +		} elseif {[string match {@@ *} $line]} {
>  			apply_tab_size 1
>  		}
>  
Just "else" without a condition would have been sufficient, but we can
do it this way as well.

I've rewritten the commit message like so:

    git-gui: shift tabstops to account for the first column of patch text
    
    When reviewing a change before staging, it is desirable to see text after
    tabstops aligned the same way as in the text editor. However, since there
    is always an additional character in column one in patch text ('+', '-',
    or space), the alignment is broken if text before the first tab character
    is just long enough to push the stop to the next tab position.
    
    Commit a43c5f51a4b1 (git-gui: add configurable tab size to the diff view,
    2012-02-12) added infrastructure that manipulates the tabstop positions
    of the Tk text widget. However, it does so only when a 3-way diff is
    shown and only so that it takes into account the one additional markup at
    the beginning of lines. This only achieved that alignment does not get
    worse for 3-way diffs compared to regular patch text, but left misaligned
    text in regular patch text unmodified.
    
    Use and modify this infrastructure to shift tabstops by one position for
    regular patch text and two positions for 3-way diffs. Existing code
    already resets the tabstops to an unshifted position when contents of
    untracked files are displayed.
    
    Signed-off-by: Chris Idema <github_chris_idema@proton.me>
    [j6t: extend commit message]
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>

In particular there was no bug; this is a new feature.

Thanks,
-- Hannes


  reply	other threads:[~2026-01-29 21:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 10:45 [PATCH] diff.tcl: fixed alignment of tabs in git-gui diff by using spaces Chris Idema via GitGitGadget
2026-01-26 12:15 ` Johannes Sixt
2026-01-26 13:32   ` GitHub Chris Idema
2026-01-26 13:59     ` Johannes Sixt
2026-01-26 14:43       ` GitHub Chris Idema
2026-01-26 14:52         ` Johannes Sixt
2026-01-26 15:21           ` GitHub Chris Idema
2026-01-26 15:32           ` GitHub Chris Idema
2026-01-27 20:33 ` [PATCH/RFC v2 0/2] diff.tcl: Fixed " Chris Idema via GitGitGadget
2026-01-27 20:33   ` [PATCH/RFC v2 1/2] diff.tcl: fixed " Chris Idema via GitGitGadget
2026-01-27 20:33   ` [PATCH/RFC v2 2/2] diff.tcl: call "apply_tab_size 1" to fix alignment instead of spaces Chris Idema via GitGitGadget
2026-01-27 22:19     ` Junio C Hamano
2026-01-27 23:26       ` Junio C Hamano
2026-01-28  9:07         ` GitHub Chris Idema
2026-01-28 13:40         ` Johannes Sixt
2026-01-28 14:02           ` GitHub Chris Idema
2026-01-28 15:59             ` Johannes Sixt
2026-01-28 23:42               ` Junio C Hamano
2026-01-29  0:06           ` Junio C Hamano
2026-01-29  8:31             ` GitHub Chris Idema
2026-01-29 10:04               ` Johannes Sixt
2026-01-29 15:17                 ` Junio C Hamano
2026-01-28 10:20   ` [PATCH/RFC v3] diff.tcl: made alignment of tabs in git-gui diff consistent with gitk Chris Idema via GitGitGadget
2026-01-28 17:02     ` Johannes Sixt
2026-01-28 19:02       ` GitHub Chris Idema
2026-01-29  0:02     ` Junio C Hamano
2026-01-29 11:09     ` [PATCH v4] git-gui: shift tabstops to account for the first column of context diffs Chris Idema via GitGitGadget
2026-01-29 21:36       ` Johannes Sixt [this message]
2026-03-04 13:32         ` GitHub Chris Idema
2026-03-04 19:22           ` Johannes Sixt

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=191b6fe4-e273-4ecd-9b73-725c2dff4306@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=github_chris_idema@proton.me \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox