aboutsummaryrefslogtreecommitdiff
path: root/git-gui/git-gui.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-03-21 09:25:58 -0700
committerJunio C Hamano <gitster@pobox.com>2026-03-21 09:25:58 -0700
commit6e8d538aab8fe4dd07ba9fb87b5c7edcfa5706ad (patch)
treee2021a881ddddc19d3959d2f2c2f6476f7f726d9 /git-gui/git-gui.sh
parentb70a02dcc9add838175b4c4a07171f8ab6b9f7c0 (diff)
parentbb52cdac6254c006e06bf0bb820268dcf024fc22 (diff)
downloadgit-6e8d538aab8fe4dd07ba9fb87b5c7edcfa5706ad.tar.xz
Merge branch 'master' of https://github.com/j6t/git-gui
* 'master' of https://github.com/j6t/git-gui: git-gui: grey out comment lines in commit message git-gui: wire up "git-gui--askyesno" with Meson git-gui: massage "git-gui--askyesno" with "generate-script.sh" git-gui: prefer shell at "/bin/sh" with Meson git-gui: fix use of GIT_CEILING_DIRECTORIES git-gui: shift tabstops to account for the first column of patch text
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-xgit-gui/git-gui.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index d3d3aa14a9..23fe76e498 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3900,6 +3900,24 @@ if {[winfo exists $ui_comm]} {
backup_commit_buffer
+ # Grey out comment lines (which are stripped from the final commit message by
+ # wash_commit_message).
+ $ui_comm tag configure commit_comment -foreground gray
+ proc dim_commit_comment_lines {} {
+ global ui_comm comment_string
+ $ui_comm tag remove commit_comment 1.0 end
+ set text [$ui_comm get 1.0 end]
+ # See also cmt_rx in wash_commit_message
+ set cmt_rx [strcat {^} [regsub -all {\W} $comment_string {\\&}]]
+ set ranges [regexp -all -indices -inline -line -- $cmt_rx $text]
+ foreach pair $ranges {
+ set idx "1.0 + [lindex $pair 0] chars"
+ $ui_comm tag add commit_comment $idx "$idx lineend + 1 char"
+ }
+ }
+ dim_commit_comment_lines
+ bind $ui_comm <<Modified>> { after idle dim_commit_comment_lines }
+
# -- If the user has aspell available we can drive it
# in pipe mode to spellcheck the commit message.
#