From: Chris Idema Date: Thu, 29 Jan 2026 11:09:04 +0000 (+0000) Subject: git-gui: shift tabstops to account for the first column of patch text X-Git-Tag: v2.54.0-rc0~53^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5139f34cec36864be90a7add024f1156af31c0f;p=thirdparty%2Fgit.git 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 [j6t: extend commit message] Signed-off-by: Johannes Sixt --- diff --git a/lib/diff.tcl b/lib/diff.tcl index 442737ba4f..8be1a613fb 100644 --- a/lib/diff.tcl +++ b/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 }