From: Johannes Sixt <j6t@kdbg•org>
To: Wolfgang Faust <contrib-git@wolfgangfaust•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] git-gui: highlight comment lines in commit message
Date: Wed, 4 Mar 2026 08:24:27 +0100 [thread overview]
Message-ID: <fd298e8c-462d-4309-a20c-ea3dcd00d09d@kdbg.org> (raw)
In-Reply-To: <c2416342-dbb8-4003-b959-cb0ed2b00eeb@app.fastmail.com>
Am 04.03.26 um 02:30 schrieb Wolfgang Faust:
> Thank you, "dim" is a better term.
You forgot to update the commit message. I took the liberty to rewrite
it like so:
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>
>> (I wonder why we need the +1char, though.)
>
> Without it, putting the cursor at the end of a comment line and typing
> causes the newly inserted text to flash black briefly. Adding +1 puts
> the tag on the other side of the cursor, so the newly added text is dim.
> (The tradeoff is that putting the cursor at the end of the comment,
> pressing enter, and typing causes the newly inserted text to be grey
> briefly. I think this looks somewhat less bad than the other way around.)
Fair enough.
> + # 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 }
Nicely done! Queued.
Thanks,
-- Hannes
prev parent reply other threads:[~2026-03-04 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 21:55 [PATCH] git-gui: highlight comment lines in commit message Wolfgang Faust
2026-03-02 11:30 ` Johannes Sixt
2026-03-04 1:30 ` Wolfgang Faust
2026-03-04 7:24 ` Johannes Sixt [this message]
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=fd298e8c-462d-4309-a20c-ea3dcd00d09d@kdbg.org \
--to=j6t@kdbg$(echo .)org \
--cc=contrib-git@wolfgangfaust$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox