diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-12-04 19:50:11 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-12-08 11:51:47 +1100 |
commit | 99a8b1ae8bb93565df8acbe168749278dc768979 (patch) | |
tree | 06f3707ff08a879cf9fac550cf71f42bbe0215bf /pkg/gui/keybindings.go | |
parent | ccc771d8b13d5b0d4635db4463556366470fd4f6 (diff) |
making a start on unidirectional data binding to fix these UI bugs
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 1a63d009c..c8c3d642f 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -219,7 +219,12 @@ func (gui *Gui) GetKeybindings() []*Binding { Handler: gui.handleSwitchToStagingPanel, Description: gui.Tr.SLocalize("StageLines"), KeyReadable: "enter", - }, { + }, + {ViewName: "files", Key: 'k', Modifier: gocui.ModNone, Handler: gui.handleFilesPrevLine}, + {ViewName: "files", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: gui.handleFilesPrevLine}, + {ViewName: "files", Key: 'j', Modifier: gocui.ModNone, Handler: gui.handleFilesNextLine}, + {ViewName: "files", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: gui.handleFilesNextLine}, + { ViewName: "main", Key: gocui.KeyEsc, Modifier: gocui.ModNone, @@ -322,7 +327,12 @@ func (gui *Gui) GetKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.handleMerge, Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"), - }, { + }, + {ViewName: "branches", Key: 'k', Modifier: gocui.ModNone, Handler: gui.handleBranchesPrevLine}, + {ViewName: "branches", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: gui.handleBranchesPrevLine}, + {ViewName: "branches", Key: 'j', Modifier: gocui.ModNone, Handler: gui.handleBranchesNextLine}, + {ViewName: "branches", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: gui.handleBranchesNextLine}, + { ViewName: "commits", Key: 's', Modifier: gocui.ModNone, @@ -352,7 +362,12 @@ func (gui *Gui) GetKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.handleCommitFixup, Description: gui.Tr.SLocalize("fixupCommit"), - }, { + }, + {ViewName: "commits", Key: 'k', Modifier: gocui.ModNone, Handler: gui.handleCommitsPrevLine}, + {ViewName: "commits", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: gui.handleCommitsPrevLine}, + {ViewName: "commits", Key: 'j', Modifier: gocui.ModNone, Handler: gui.handleCommitsNextLine}, + {ViewName: "commits", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: gui.handleCommitsNextLine}, + { ViewName: "stash", Key: gocui.KeySpace, Modifier: gocui.ModNone, @@ -455,17 +470,22 @@ func (gui *Gui) GetKeybindings() []*Binding { // Would make these keybindings global but that interferes with editing // input in the confirmation panel - for _, viewName := range []string{"status", "files", "branches", "commits", "stash", "menu"} { + for _, viewName := range []string{"status", "commits", "stash", "menu"} { + bindings = append(bindings, []*Binding{ + {ViewName: viewName, Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: gui.cursorUp}, + {ViewName: viewName, Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: gui.cursorDown}, + {ViewName: viewName, Key: 'k', Modifier: gocui.ModNone, Handler: gui.cursorUp}, + {ViewName: viewName, Key: 'j', Modifier: gocui.ModNone, Handler: gui.cursorDown}, + }...) + } + + for _, viewName := range []string{"status", "branches", "files", "commits", "stash", "menu"} { bindings = append(bindings, []*Binding{ {ViewName: viewName, Key: gocui.KeyTab, Modifier: gocui.ModNone, Handler: gui.nextView}, {ViewName: viewName, Key: gocui.KeyArrowLeft, Modifier: gocui.ModNone, Handler: gui.previousView}, {ViewName: viewName, Key: gocui.KeyArrowRight, Modifier: gocui.ModNone, Handler: gui.nextView}, - {ViewName: viewName, Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: gui.cursorUp}, - {ViewName: viewName, Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: gui.cursorDown}, {ViewName: viewName, Key: 'h', Modifier: gocui.ModNone, Handler: gui.previousView}, {ViewName: viewName, Key: 'l', Modifier: gocui.ModNone, Handler: gui.nextView}, - {ViewName: viewName, Key: 'k', Modifier: gocui.ModNone, Handler: gui.cursorUp}, - {ViewName: viewName, Key: 'j', Modifier: gocui.ModNone, Handler: gui.cursorDown}, }...) } |