summaryrefslogtreecommitdiffstats
path: root/pkg/gui/keybindings.go
diff options
context:
space:
mode:
authorMark Kopenga <mkopenga@gmail.com>2018-12-06 08:31:12 +0100
committerGitHub <noreply@github.com>2018-12-06 08:31:12 +0100
commit1b6d34e76a4d5d132f95072139fb3aba760eb771 (patch)
treefb6cc607a67f0d3d2ef0b9d66fafd439864e6d9a /pkg/gui/keybindings.go
parent67115436347dec591d12a1a31d1c971915cf0b05 (diff)
parent1a6a69a8f1f7c44978a384ba56321149f973223d (diff)
Merge branch 'master' into https-ask-for-username-password
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r--pkg/gui/keybindings.go68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index b926853ba..28647b245 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -21,6 +21,7 @@ func (b *Binding) GetDisplayStrings() []string {
return []string{b.GetKey(), b.Description}
}
+// GetKey is a function.
func (b *Binding) GetKey() string {
r, ok := b.Key.(rune)
key := ""
@@ -34,6 +35,7 @@ func (b *Binding) GetKey() string {
return key
}
+// GetKeybindings is a function.
func (gui *Gui) GetKeybindings() []*Binding {
bindings := []*Binding{
{
@@ -211,6 +213,13 @@ func (gui *Gui) GetKeybindings() []*Binding {
Handler: gui.handleResetHard,
Description: gui.Tr.SLocalize("resetHard"),
}, {
+ ViewName: "files",
+ Key: gocui.KeyEnter,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleSwitchToStagingPanel,
+ Description: gui.Tr.SLocalize("StageLines"),
+ KeyReadable: "enter",
+ }, {
ViewName: "main",
Key: gocui.KeyEsc,
Modifier: gocui.ModNone,
@@ -398,6 +407,65 @@ func (gui *Gui) GetKeybindings() []*Binding {
Key: 'q',
Modifier: gocui.ModNone,
Handler: gui.handleMenuClose,
+ }, {
+ ViewName: "staging",
+ Key: gocui.KeyEsc,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingEscape,
+ KeyReadable: "esc",
+ Description: gui.Tr.SLocalize("EscapeStaging"),
+ }, {
+ ViewName: "staging",
+ Key: gocui.KeyArrowUp,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingPrevLine,
+ }, {
+ ViewName: "staging",
+ Key: gocui.KeyArrowDown,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingNextLine,
+ }, {
+ ViewName: "staging",
+ Key: 'k',
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingPrevLine,
+ }, {
+ ViewName: "staging",
+ Key: 'j',
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingNextLine,
+ }, {
+ ViewName: "staging",
+ Key: gocui.KeyArrowLeft,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingPrevHunk,
+ }, {
+ ViewName: "staging",
+ Key: gocui.KeyArrowRight,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingNextHunk,
+ }, {
+ ViewName: "staging",
+ Key: 'h',
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingPrevHunk,
+ }, {
+ ViewName: "staging",
+ Key: 'l',
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStagingNextHunk,
+ }, {
+ ViewName: "staging",
+ Key: gocui.KeySpace,
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStageLine,
+ Description: gui.Tr.SLocalize("StageLine"),
+ }, {
+ ViewName: "staging",
+ Key: 'a',
+ Modifier: gocui.ModNone,
+ Handler: gui.handleStageHunk,
+ Description: gui.Tr.SLocalize("StageHunk"),
},
}