Re: Display line numbers in gitk?
From: Sebastian Schuberth <hidden>
Date: 2016-06-15 22:52:13
On Tue, Oct 11, 2011 at 16:00, Pat Thoyts [off-list ref] wrote: (putting the list back on CC)
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 hunk
From 0e18a9a2789838925f2ed50b05ce9d7e6c3a9a38 Mon Sep 17 00:00:00 2001 From: Pat Thoyts <redacted> Date: Tue, 11 Oct 2011 14:57:24 +0100 Subject: [PATCH] gitk: display line numbers for file view Suggested-by: Sebastian Schuberth <redacted> Signed-off-by: Pat Thoyts <redacted> --- gitk | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)diff --git a/gitk b/gitk index 4cde0c4..70d8f57 100755 --- a/gitk +++ b/gitk@@ -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 x@@ -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]} { global jump_to_here ctext_file_names commentend -- 1.7.7.1.gbba15