@matheusbsbs / matheus-bagliano / commits / 60aa065f69
Fork 0

git-gui: Allow vi keys to scroll the diff/blame regions

Users who are used to vi and recent versions of gitk may want to scroll the diff region using vi style keybindings. Since these aren't bound to anything else and that widget does not accept focus for data input, we can easily support that too. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed May 1, 2007 at 15:51 UTC 60aa065f6958a888d14178ca94f17a60100d3709
2 files changed +23
git-gui.sh
+6
@@ -2038,6 +2038,12 @@ bind $ui_diff <Key-Up> {catch {%W yview scroll -1 units};break}
2038 bind $ui_diff <Key-Down> {catch {%W yview scroll 1 units};break}
2039 bind $ui_diff <Key-Left> {catch {%W xview scroll -1 units};break}
2040 bind $ui_diff <Key-Right> {catch {%W xview scroll 1 units};break}
2041 +bind $ui_diff <Key-k> {catch {%W yview scroll -1 units};break}
2042 +bind $ui_diff <Key-j> {catch {%W yview scroll 1 units};break}
2043 +bind $ui_diff <Key-h> {catch {%W xview scroll -1 units};break}
2044 +bind $ui_diff <Key-l> {catch {%W xview scroll 1 units};break}
2045 +bind $ui_diff <Control-Key-b> {catch {%W yview scroll -1 pages};break}
2046 +bind $ui_diff <Control-Key-f> {catch {%W yview scroll 1 pages};break}
2047 bind $ui_diff <Button-1> {focus %W}
2048
2049 if {[is_enabled branch]} {
lib/blame.tcl
+17
@@ -125,6 +125,23 @@ proc show_blame {commit path} {
125 "
126 }
127
128 + foreach i [list \
129 + $w.out.loaded_t \
130 + $w.out.linenumber_t \
131 + $w.out.file_t \
132 + $w.cm.t] {
133 + bind $i <Key-Up> {catch {%W yview scroll -1 units};break}
134 + bind $i <Key-Down> {catch {%W yview scroll 1 units};break}
135 + bind $i <Key-Left> {catch {%W xview scroll -1 units};break}
136 + bind $i <Key-Right> {catch {%W xview scroll 1 units};break}
137 + bind $i <Key-k> {catch {%W yview scroll -1 units};break}
138 + bind $i <Key-j> {catch {%W yview scroll 1 units};break}
139 + bind $i <Key-h> {catch {%W xview scroll -1 units};break}
140 + bind $i <Key-l> {catch {%W xview scroll 1 units};break}
141 + bind $i <Control-Key-b> {catch {%W yview scroll -1 pages};break}
142 + bind $i <Control-Key-f> {catch {%W yview scroll 1 pages};break}
143 + }
144 +
145 bind $w.cm.t <Button-1> "focus $w.cm.t"
146 bind $tl <Visibility> "focus $tl"
147 bind $tl <Destroy> "