Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/git-gui/lib/line.tcl # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / git-gui / lib / line.tcl` 80 lines ยท 1322 bytes Raw Blame History 1 # goto line number 2 # based on code from gitk, Copyright (C) Paul Mackerras 3 4 class linebar { 5 6 field w 7 field ctext 8 9 field linenum {} 10 11 constructor new {i_w i_text args} { 12 set w $i_w 13 set ctext $i_text 14 15 ttk::frame $w 16 ttk::label $w.l -text [mc "Goto Line:"] 17 tentry $w.ent \ 18 -textvariable ${__this}::linenum \ 19 -background lightgreen \ 20 -validate key \ 21 -validatecommand [cb _validate %P] 22 ttk::button $w.bn -text [mc Go] -command [cb _goto] 23 24 pack $w.l -side left 25 pack $w.bn -side right 26 pack $w.ent -side left -expand 1 -fill x 27 28 eval grid conf $w -sticky we $args 29 grid remove $w 30 31 trace add variable linenum write [cb _goto_cb] 32 bind $w.ent [cb _goto] 33 bind $w.ent [cb hide] 34 35 bind $w [list delete_this $this] 36 return $this 37 } 38 39 method show {} { 40 if {![visible $this]} { 41 grid $w 42 } 43 focus -force $w.ent 44 } 45 46 method hide {} { 47 if {[visible $this]} { 48 $w.ent delete 0 end 49 focus $ctext 50 grid remove $w 51 } 52 } 53 54 method visible {} { 55 return [winfo ismapped $w] 56 } 57 58 method editor {} { 59 return $w.ent 60 } 61 62 method _validate {P} { 63 # only accept numbers as input 64 string is integer $P 65 } 66 67 method _goto_cb {name ix op} { 68 after idle [cb _goto 1] 69 } 70 71 method _goto {{nohide {0}}} { 72 if {$linenum ne {}} { 73 $ctext see $linenum.0 74 if {!$nohide} { 75 hide $this 76 } 77 } 78 } 79 80 }