From: "Chris Idema via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Chris Idema <github_chris_idema@proton.me>,
Chris Idema <github_chris_idema@proton.me>
Subject: [PATCH/RFC v3] diff.tcl: made alignment of tabs in git-gui diff consistent with gitk
Date: Wed, 28 Jan 2026 10:20:39 +0000 [thread overview]
Message-ID: <pull.2179.v3.git.git.1769595640008.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2179.v2.git.git.1769545996.gitgitgadget@gmail.com>
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.
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
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2179%2FChrisIdema%2Ffix-gitgui-diff-tab-alignment-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2179/ChrisIdema/fix-gitgui-diff-tab-alignment-v3
Pull-Request: https://github.com/git/git/pull/2179
Range-diff vs v2:
1: f2a09c15eb < -: ---------- diff.tcl: fixed alignment of tabs in git-gui diff by using spaces
2: e11aa6d811 ! 1: 18d25b90c4 diff.tcl: call "apply_tab_size 1" to fix alignment instead of spaces.
@@ Metadata
Author: Chris Idema <github_chris_idema@proton.me>
## Commit message ##
- diff.tcl: call "apply_tab_size 1" to fix alignment instead of spaces.
+ diff.tcl: made alignment of tabs in git-gui diff consistent with gitk
+
+ 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.
Signed-off-by: Chris Idema <github_chris_idema@proton.me>
## git-gui/lib/diff.tcl ##
-@@ git-gui/lib/diff.tcl: proc apply_tab_size {{firsttab {}}} {
- }
- }
-
--proc expand_tabs {line {startcol -1}} {
-- # startcol set to -1, because in preview the lines start with a '+', '-', or ' '
-- global repo_config
--
-- set col $startcol
-- set out ""
--
-- foreach char [split $line ""] {
-- if {$char eq "\t"} {
-- set spaces [expr {$repo_config(gui.tabsize) - ($col % $repo_config(gui.tabsize))}]
-- append out [string repeat " " $spaces]
-- incr col $spaces
-- } else {
-- append out $char
-- incr col
-- }
-- }
--
-- return $out
--}
--
- proc clear_diff {} {
- global ui_diff current_diff_path current_diff_header
- global ui_index ui_workdir
@@ git-gui/lib/diff.tcl: proc read_diff {fd conflict_size cont_info} {
}
}
set mark [$ui_diff index "end - 1 line linestart"]
-- set line [expand_tabs $line]
+ apply_tab_size 1
- $ui_diff insert end "$line" $tags
--
+ $ui_diff insert end $line $tags
if {[string index $line end] eq "\r"} {
$ui_diff tag add d_cr {end - 2c}
- }
git-gui/lib/diff.tcl | 1 +
1 file changed, 1 insertion(+)
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}
base-commit: 1faf5b085a171f9ba9a6d7a446e0de16acccb1dc
--
gitgitgadget
next prev parent reply other threads:[~2026-01-28 10:20 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 ` Chris Idema via GitGitGadget [this message]
2026-01-28 17:02 ` [PATCH/RFC v3] diff.tcl: made alignment of tabs in git-gui diff consistent with gitk 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
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=pull.2179.v3.git.git.1769595640008.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--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 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.