git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Display line numbers in gitk?
@ 2011-10-08 13:27 Sebastian Schuberth
       [not found] ` <CABNJ2GLaquXK7o_V_6KmOtnbcCGXMgbupbVJzXU_yK=2a=wKSg@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Schuberth @ 2011-10-08 13:27 UTC (permalink / raw)
  To: git; +Cc: Pat Thoyts

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?

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Display line numbers in gitk?
       [not found] ` <CABNJ2GLaquXK7o_V_6KmOtnbcCGXMgbupbVJzXU_yK=2a=wKSg@mail.gmail.com>
@ 2011-10-11 14:16   ` Sebastian Schuberth
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Schuberth @ 2011-10-11 14:16 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: git

On Tue, Oct 11, 2011 at 16:00, Pat Thoyts <patthoyts@gmail.com> 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.

> From 0e18a9a2789838925f2ed50b05ce9d7e6c3a9a38 Mon Sep 17 00:00:00 2001
> From: Pat Thoyts <patthoyts@users.sourceforge.net>
> Date: Tue, 11 Oct 2011 14:57:24 +0100
> Subject: [PATCH] gitk: display line numbers for file view
>
> Suggested-by: Sebastian Schuberth <sschuberth@gmail.com>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-11 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-08 13:27 Display line numbers in gitk? Sebastian Schuberth
     [not found] ` <CABNJ2GLaquXK7o_V_6KmOtnbcCGXMgbupbVJzXU_yK=2a=wKSg@mail.gmail.com>
2011-10-11 14:16   ` Sebastian Schuberth

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).