summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Burville <Sam.Burville@GlobalProcessing.com>2021-10-18 10:06:03 +0100
committerJesse Duffield <jessedduffield@gmail.com>2021-10-22 22:38:26 +1100
commit5df0475612464e9f030808cad926c44935f2c685 (patch)
treec17ea2615bbc353b9c29269ee458a3dc3b3f1691
parentf6e316dfe5a35696e091f760e533a7a62f946f99 (diff)
Add variable to simplify JumpToBlock keybinding
This removes the magic '5' and instead uses the number of windows.
-rw-r--r--pkg/gui/keybindings.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index 76a33a33a..d441c496c 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -1818,10 +1818,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
}
// Appends keybindings to jump to a particular sideView using numbers
- if len(config.Universal.JumpToBlock) != 5 {
+ windows := []string{"status", "files", "branches", "commits", "stash"}
+
+ if len(config.Universal.JumpToBlock) != len(windows) {
log.Fatal("Jump to block keybindings cannot be set. Exactly 5 keybindings must be supplied.")
} else {
- for i, window := range []string{"status", "files", "branches", "commits", "stash"} {
+ for i, window := range windows {
bindings = append(bindings, &Binding{
ViewName: "",
Key: gui.getKey(config.Universal.JumpToBlock[i]),