Display line numbers in gitk?
Hi,
is there currently a way to display line numbers next to each line in the diff shown by gitk, e.g. in some kind of gutter?
If that's currently not possible, how much work would it require to add that feature as an option?
Signature · 1 line
Sebastian Schuberth
A message that is not in the archive (sent off-list or not yet received): CABNJ2GLaquXK7o_V_6KmOtnbcCGXMgbupbVJzXU_yK=2a=wKSg@mail.gmail.com
On Tue, Oct 11, 2011 at 16:00, Pat Thoyts <[email protected]> wrote:
(putting the list back on CC)
Quoted 3 lines
Not currently possible. It can be done though. Is this just for the file view or patch view as well?
The following seems to work reasonably well for just the file view.
Thanks, from my tests it seems to work indeed very well. Although I was initially thinking about the patch view.
A downside of line numbers in the file view could be that they'll be copied to the clipboard, too, if you copy and paste code from there, so they should probably be implemented as an option.
Quoted 37 lines
From
0e18a9a2789838925f2ed50b05ce9d7e6c3a9a38Mon Sep 17 00:00:00 2001
From: Pat Thoyts <[email protected]>
Date: Tue, 11 Oct 2011 14:57:24 +0100
Subject: [PATCH] gitk: display line numbers for file viewSuggested-by Sebastian Schuberth <[email protected]>Signed-off-by Pat Thoyts <[email protected]>---
gitk | 5 ++++-1 files changed, 4 insertions(+), 1 deletions(-)gitk +0
-0@@ -2277,6 +2277,9 @@ proc makewindow {} { if {$have_tk85} {$ctext conf -tabstyle wordprocessor
}
+ catch {eval font create linenofont [font configure textfont] \
+ -size [expr {[font configure textfont -size] - 2}]}
+ $ctext tag configure lineno -foreground #808080 -font linenofont ${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview" ${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h
pack .bleft.top -side top -fill xgitk +0
-0@@ -7316,7 +7319,7 @@ proc getblobline {bf id} {$ctext config -state normal
set nl 0
while {[incr nl] <= 1000 && [gets $bf line] >= 0} {
- $ctext insert end "$line\n"
+ $ctext insert end $nl lineno "\t" {} "$line\n" }
if {[eof $bf]} {
globaljump_to_herectext_file_namescommentend --
1.7.7.1.gbba15