summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 49b86f0)
raw | patch | inline | side by side (parent: 49b86f0)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sat, 11 Nov 2006 20:51:41 +0000 (15:51 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 12 Nov 2006 05:16:00 +0000 (00:16 -0500) |
Users have come to expect basic editing features within their
applications, such as cut/copy/paste/undo/redo/select-all. I
found these features to be lacking in git-gui so now we have
them.
I also added basic keyboard bindings for the diff viewing area
so that the arrow keys move around single units (lines or columns)
and the M1-X/C keys will copy the selected text and the M1-A key
will select the entire diff.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
applications, such as cut/copy/paste/undo/redo/select-all. I
found these features to be lacking in git-gui so now we have
them.
I also added basic keyboard bindings for the diff viewing area
so that the arrow keys move around single units (lines or columns)
and the M1-X/C keys will copy the selected text and the M1-A key
will select the entire diff.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui | patch | blob | history |
index 20c36c2d2e3e2c9bf68da635bdd001f0c806417a..640519c204c904eb3982a827f44c997165639dd2 100755 (executable)
--- a/git-gui
+++ b/git-gui
# -- Menu Bar
menu .mbar -tearoff 0
.mbar add cascade -label Project -menu .mbar.project
+.mbar add cascade -label Edit -menu .mbar.edit
.mbar add cascade -label Commit -menu .mbar.commit
.mbar add cascade -label Fetch -menu .mbar.fetch
.mbar add cascade -label Pull -menu .mbar.pull
-accelerator $M1T-Q \
-font $mainfont
+# -- Edit Menu
+#
+menu .mbar.edit
+.mbar.edit add command -label Undo \
+ -command {catch {[focus] edit undo}} \
+ -accelerator $M1T-Z \
+ -font $mainfont
+.mbar.edit add command -label Redo \
+ -command {catch {[focus] edit redo}} \
+ -accelerator $M1T-Y \
+ -font $mainfont
+.mbar.edit add separator
+.mbar.edit add command -label Cut \
+ -command {catch {tk_textCut [focus]}} \
+ -accelerator $M1T-X \
+ -font $mainfont
+.mbar.edit add command -label Copy \
+ -command {catch {tk_textCopy [focus]}} \
+ -accelerator $M1T-C \
+ -font $mainfont
+.mbar.edit add command -label Paste \
+ -command {catch {tk_textPaste [focus]; [focus] see insert}} \
+ -accelerator $M1T-V \
+ -font $mainfont
+.mbar.edit add command -label Delete \
+ -command {catch {[focus] delete sel.first sel.last}} \
+ -accelerator Del \
+ -font $mainfont
+.mbar.edit add separator
+.mbar.edit add command -label {Select All} \
+ -command {catch {[focus] tag add sel 0.0 end}} \
+ -accelerator $M1T-A \
+ -font $mainfont
+
# -- Commit Menu
menu .mbar.commit
.mbar.commit add command -label Rescan \
# -- Options Menu
menu .mbar.options
-.mbar.options add checkbutton -label {Trust File Modification Timestamps} \
+.mbar.options add checkbutton \
+ -label {Trust File Modification Timestamps} \
-offvalue false \
-onvalue true \
-variable cfg_trust_mtime
* {$ui_coml conf -text {Commit Message:}}
}}
text $ui_comm -background white -borderwidth 1 \
+ -undo true \
+ -autoseparators true \
-relief sunken \
-width 75 -height 9 -wrap none \
-font $difffont \
bind $ui_comm <$M1B-Key-Return> {do_commit;break}
bind $ui_comm <$M1B-Key-i> {do_include_all;break}
bind $ui_comm <$M1B-Key-I> {do_include_all;break}
+bind $ui_comm <$M1B-Key-x> {tk_textCut %W;break}
+bind $ui_comm <$M1B-Key-X> {tk_textCut %W;break}
+bind $ui_comm <$M1B-Key-c> {tk_textCopy %W;break}
+bind $ui_comm <$M1B-Key-C> {tk_textCopy %W;break}
+bind $ui_comm <$M1B-Key-v> {tk_textPaste %W; %W see insert; break}
+bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}
+bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}
+bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}
+
+bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
+bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
+bind $ui_diff <$M1B-Key-c> {tk_textCopy %W;break}
+bind $ui_diff <$M1B-Key-C> {tk_textCopy %W;break}
+bind $ui_diff <$M1B-Key-v> {break}
+bind $ui_diff <$M1B-Key-V> {break}
+bind $ui_diff <$M1B-Key-a> {%W tag add sel 0.0 end;break}
+bind $ui_diff <$M1B-Key-A> {%W tag add sel 0.0 end;break}
+bind $ui_diff <Key-Up> {%W yview scroll -1 units}
+bind $ui_diff <Key-Down> {%W yview scroll 1 units}
+bind $ui_diff <Key-Left> {%W xview scroll -1 units}
+bind $ui_diff <Key-Right> {%W xview scroll 1 units}
bind . <Destroy> do_quit
bind all <Key-F5> do_rescan