diff options
| author | Wolfgang Faust <contrib-git@wolfgangfaust.com> | 2026-03-03 17:30:52 -0800 |
|---|---|---|
| committer | Johannes Sixt <j6t@kdbg.org> | 2026-03-04 08:04:37 +0100 |
| commit | bb52cdac6254c006e06bf0bb820268dcf024fc22 (patch) | |
| tree | 652013d6ce3d29a0900e96efd565a8163f259b56 | |
| parent | 8d55f6ec2547c307b149a5c345bd25100199ec2a (diff) | |
| download | git-bb52cdac6254c006e06bf0bb820268dcf024fc22.tar.xz | |
git-gui: grey out comment lines in commit message
Comment lines are stripped by wash_commit_message, but there is no
indication in the UI that they are special and will be removed.
Grey these lines out to indicate that they will be removed.
Signed-off-by: Wolfgang Faust <contrib-git@wolfgangfaust.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
| -rwxr-xr-x | git-gui.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh index d3d3aa14a9..23fe76e498 100755 --- a/git-gui.sh +++ b/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. # |
