Skip to contentSkip to conversation

git-gui blame, add a Control-G goto line option

PATCH In review David Fries 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 git-gui blame, add a Control-G goto line option

Add a goto input field to jump to the specified line similar to the current search field.

---
 git-gui/lib/blame.tcl |   11 ++++++++
 git-gui/lib/line.tcl  |   62 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 git-gui/lib/line.tcl
git-gui/lib/blame.tcl +11 -0
index 61e358f..062091b 100644
@@ -22,6 +22,7 @@ field w_asim     ; # text column: annotations (simple computation)
 field w_file     ; # text column: actual file data
 field w_cviewer  ; # pane showing commit message
 field finder     ; # find mini-dialog frame
+field gotoline   ; # line goto mini-dialog frame
 field status     ; # status mega-widget instance
 field old_height ; # last known height of $w.file_pane
 
@@ -231,6 +232,11 @@ constructor new {i_commit i_path i_jump} {
 		-column [expr {[llength $w_columns] - 1}] \
 		]
 
+	set gotoline [::linebar::new \
+		$w.file_pane.out.lf $w_file \
+		-column [expr {[llength $w_columns] - 1}] \
+		]
+
 	set w_cviewer $w.file_pane.cm.t
 	text $w_cviewer \
 		-background white \
@@ -275,6 +281,10 @@ constructor new {i_commit i_path i_jump} {
 		-label [mc "Find Text..."] \
 		-accelerator F7 \
 		-command [list searchbar::show $finder]
+	$w.ctxm add command \
+		-label [mc "Goto Line..."] \
+		-accelerator Control-Key-g \
+		-command [list linebar::show $gotoline]
 	menu $w.ctxm.enc
 	build_encoding_menu $w.ctxm.enc [cb _setencoding]
 	$w.ctxm add cascade \
@@ -345,6 +355,7 @@ constructor new {i_commit i_path i_jump} {
 	bind $top       <Escape>     [list searchbar::hide $finder]
 	bind $top       <F3>         [list searchbar::find_next $finder]
 	bind $top       <Shift-F3>   [list searchbar::find_prev $finder]
+	bind $top    <Control-Key-g> [list linebar::show $gotoline]
 	catch { bind $top <Shift-Key-XF86_Switch_VT_3> [list searchbar::find_prev $finder] }
 
 	grid configure $w.header -sticky ew
git-gui/lib/line.tcl new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#1 lore raw

Add a goto input field to jump to the specified line similar to the current search field.

---
This version hides the goto widget when pressing return or escape. Patch 2/2 is unchanged.

 git-gui/lib/blame.tcl |   11 ++++++++
 git-gui/lib/line.tcl  |   64 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 git-gui/lib/line.tcl
git-gui/lib/blame.tcl +11 -0
index 61e358f..062091b 100644
@@ -22,6 +22,7 @@ field w_asim     ; # text column: annotations (simple computation)
 field w_file     ; # text column: actual file data
 field w_cviewer  ; # pane showing commit message
 field finder     ; # find mini-dialog frame
+field gotoline   ; # line goto mini-dialog frame
 field status     ; # status mega-widget instance
 field old_height ; # last known height of $w.file_pane
 
@@ -231,6 +232,11 @@ constructor new {i_commit i_path i_jump} {
 		-column [expr {[llength $w_columns] - 1}] \
 		]
 
+	set gotoline [::linebar::new \
+		$w.file_pane.out.lf $w_file \
+		-column [expr {[llength $w_columns] - 1}] \
+		]
+
 	set w_cviewer $w.file_pane.cm.t
 	text $w_cviewer \
 		-background white \
@@ -275,6 +281,10 @@ constructor new {i_commit i_path i_jump} {
 		-label [mc "Find Text..."] \
 		-accelerator F7 \
 		-command [list searchbar::show $finder]
+	$w.ctxm add command \
+		-label [mc "Goto Line..."] \
+		-accelerator Control-Key-g \
+		-command [list linebar::show $gotoline]
 	menu $w.ctxm.enc
 	build_encoding_menu $w.ctxm.enc [cb _setencoding]
 	$w.ctxm add cascade \
@@ -345,6 +355,7 @@ constructor new {i_commit i_path i_jump} {
 	bind $top       <Escape>     [list searchbar::hide $finder]
 	bind $top       <F3>         [list searchbar::find_next $finder]
 	bind $top       <Shift-F3>   [list searchbar::find_prev $finder]
+	bind $top    <Control-Key-g> [list linebar::show $gotoline]
 	catch { bind $top <Shift-Key-XF86_Switch_VT_3> [list searchbar::find_prev $finder] }
 
 	grid configure $w.header -sticky ew
git-gui/lib/line.tcl new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.7.2.5