Re: [PATCH/RFC v3] diff.tcl: made alignment of tabs in git-gui diff consistent with gitk
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Jan 28, 2026, 17:02 UTC
- Message-ID
- <547d261c-a716-4c57-8b93-09cf7d8fb176@kdbg.org>
- In-Reply-To
- <pull.2179.v3.git.git.1769595640008.gitgitgadget@gmail.com>
Am 28.01.26 um 11:20 schrieb Chris Idema via GitGitGadget:
Show 5 quoted lines
> From: Chris Idema <github_chris_idema@proton.me> > > Tab stop width was not properly rendered in TK regardless of > tab width setting. The + or minus character at start of line made > tabs align incorrectly.
This is a patch for Git GUI. Please use the subject prefix "git-gui:". The file name need not be mentioned.
Please have a look at existing commits and mimic the style of the commit subject and body text. In particular:
- Use present tense to describe the current state. Elaborate what the problem is. Assume that readers haven't looked at the code for some time and guide them to the problem point (i.e., provide some context).
- Use imperative mood to describe the change as if you instruct someone to make the change.
I suggest this subject:
git-gui: shift tabstops to account for the first column of context diffs
Show 6 quoted lines
> > Signed-off-by: Chris Idema <github_chris_idema@proton.me> > --- > diff.tcl: made alignment of tabs in git-gui diff consistent with gitk > > cc: Johannes Sixt j6t@kdbg.org
Just FYI, this message didn't arrive in my mailbox despite this line.
Show 12 quoted lines
> diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
> index 442737ba4f..7da6e5ccae 100644
> --- a/git-gui/lib/diff.tcl
> +++ b/git-gui/lib/diff.tcl
> @@ -495,6 +495,7 @@ proc read_diff {fd conflict_size cont_info} {
> }
> }
> set mark [$ui_diff index "end - 1 line linestart"]
> + apply_tab_size 1
> $ui_diff insert end $line $tags
> if {[string index $line end] eq "\r"} {
> $ui_diff tag add d_cr {end - 2c}If you look at commit a43c5f51a4b1, you will notice that it intended to apply "magic" tabstops only to 3-way-diffs. It did not intend to "fix" regular patch text. Without the change, 3-way-diffs would become even more misaligned, because these have two initial positions instead of just one. To fix the additional misalignment, it applies the offset 1 to the tabstops. But this does not fix the original misalignment.
You now want to fix the original misalignment. Therefore, you have to apply the offset 1 for regular patch text, but offset 2 to 3-way-diffs. And, in addition, no offset if file contents are displayed.
-- Hannes