From: mitchr <mitchr@mitchr.dev>
To: git@vger.kernel.org
Cc: Mitchell Riley <mitchr@mitchr.dev>
Subject: [PATCH] git-gui: Indicate cursor position in commit buffer
Date: Tue, 26 Apr 2022 20:25:20 -0400 [thread overview]
Message-ID: <20220427002520.99115-1-mitchr@mitchr.dev> (raw)
From: Mitchell Riley <mitchr@mitchr.dev>
Add a visual indicator for both the line and column position of the
cursor to the bottom right of the commit buffer.
Signed-off-by: Mitchell Riley <mitchr@mitchr.dev>
---
git-gui.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/git-gui.sh b/git-gui.sh
index 201524c..a0cdf5c 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3411,8 +3411,10 @@ if {![is_enabled nocommit]} {
#
${NS}::frame .vpane.lower.commarea.buffer
${NS}::frame .vpane.lower.commarea.buffer.header
+${NS}::frame .vpane.lower.commarea.buffer.footer
set ui_comm .vpane.lower.commarea.buffer.frame.t
set ui_coml .vpane.lower.commarea.buffer.header.l
+set ui_comm_pos .vpane.lower.commarea.buffer.footer
if {![is_enabled nocommit]} {
${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \
@@ -3465,10 +3467,23 @@ ${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \
-orient vertical \
-command [list $ui_comm yview]
+set line 0
+set col 0
+${NS}::label $ui_comm_pos.ll -text "Ln "
+${NS}::label $ui_comm_pos.lb -textvariable line
+${NS}::label $ui_comm_pos.cl -text ", Col "
+${NS}::label $ui_comm_pos.cb -textvariable col
+bind $ui_comm <KeyRelease> {lassign [split [$ui_comm index insert] "."] line col}
+pack $ui_comm_pos.cb -side right
+pack $ui_comm_pos.cl -side right
+pack $ui_comm_pos.lb -side right
+pack $ui_comm_pos.ll -side right
+
pack .vpane.lower.commarea.buffer.frame.sbx -side bottom -fill x
pack .vpane.lower.commarea.buffer.frame.sby -side right -fill y
pack $ui_comm -side left -fill y
pack .vpane.lower.commarea.buffer.header -side top -fill x
+pack .vpane.lower.commarea.buffer.footer -side bottom -fill x
pack .vpane.lower.commarea.buffer.frame -side left -fill y
pack .vpane.lower.commarea.buffer -side left -fill y
--
2.32.0
reply other threads:[~2022-04-27 0:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220427002520.99115-1-mitchr@mitchr.dev \
--to=mitchr@mitchr.dev \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).