git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-gui: delegate selection from gutter columns to text output
@ 2011-10-20 19:45 Bert Wesarg
  2011-10-21 22:24 ` Pat Thoyts
  0 siblings, 1 reply; 4+ messages in thread
From: Bert Wesarg @ 2011-10-20 19:45 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: git, Bert Wesarg

Selecting in the gutter columns of the blame view should make no sense,
so delegate any selection action in these columns to the text output
by selecting whole lines there.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 git-gui.sh    |   20 ++++++++++++++++++++
 lib/blame.tcl |    4 +++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index 21033cb..cf5ed79 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2077,6 +2077,26 @@ proc many2scrollbar {list mode sb top bottom} {
 	foreach w $list {$w $mode moveto $top}
 }
 
+proc delegate_sel_to {w from} {
+	set bind_list [list \
+		<Button-1> \
+		<B1-Motion> \
+		<Double-Button-1> \
+		<Triple-Button-1> \
+		<Shift-Button-1> \
+		<Double-Shift-Button-1> \
+		<Triple-Shift-Button-1> \
+	]
+
+	foreach seq $bind_list {
+		set script [bind Text $seq]
+		set new_script [string map [list %W $w %x 0 word line] $script]
+		foreach f $from {
+			bind $f $seq "$new_script; break"
+		}
+	}
+}
+
 proc incr_font_size {font {amt 1}} {
 	set sz [font configure $font -size]
 	incr sz $amt
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 49eae19..9ab0da5 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {
 
 	set w_columns [list $w_amov $w_asim $w_line $w_file]
 
+	delegate_sel_to $w_file [list $w_amov $w_asim $w_line]
+
 	${NS}::scrollbar $w.file_pane.out.sbx \
 		-orient h \
 		-command [list $w_file xview]
@@ -315,7 +317,7 @@ constructor new {i_commit i_path i_jump} {
 		$i conf -yscrollcommand \
 			"[list ::searchbar::scrolled $finder]
 			 [list many2scrollbar $w_columns yview $w.file_pane.out.sby]"
-		bind $i <Button-1> "
+		bind $i <Button-1> "+
 			[cb _hide_tooltip]
 			[cb _click $i @%x,%y]
 			focus $i
-- 
1.7.7.759.gfc8c6

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

end of thread, other threads:[~2011-10-22 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-20 19:45 [PATCH] git-gui: delegate selection from gutter columns to text output Bert Wesarg
2011-10-21 22:24 ` Pat Thoyts
2011-10-22 15:41   ` Bert Wesarg
2011-10-22 19:38     ` [PATCHv2] " Bert Wesarg

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