diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 10:31:19 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | f876d8fdc82235f75a11a5807f05b4d8b469d521 (patch) | |
tree | 097360aba9699396d31f7d6b2b72eeb7e8bb13cb /pkg/gui | |
parent | 4198bbae6cc3747ee45d47648acab2b91f121272 (diff) |
use constants
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/context.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go index a1f0ae251..3bfbab089 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -591,20 +591,20 @@ func (gui *Gui) onViewFocusLost(v *gocui.View, newView *gocui.View) error { // which currently just means a context that affects both the main and secondary views // other views can have their context changed directly but this function helps // keep the main and secondary views in sync -func (gui *Gui) changeMainViewsContext(context string) { - if gui.State.MainContext == context { +func (gui *Gui) changeMainViewsContext(contextKey string) { + if gui.State.MainContext == contextKey { return } - switch context { - case "normal", "patchBuilding", "staging", "merging": - gui.getMainView().Context = context - gui.getSecondaryView().Context = context + switch contextKey { + case MAIN_NORMAL_CONTEXT_KEY, MAIN_PATCH_BUILDING_CONTEXT_KEY, MAIN_STAGING_CONTEXT_KEY, MAIN_MERGING_CONTEXT_KEY: + gui.getMainView().Context = contextKey + gui.getSecondaryView().Context = contextKey default: - panic(fmt.Sprintf("unknown context for main: %s", context)) + panic(fmt.Sprintf("unknown context for main: %s", contextKey)) } - gui.State.MainContext = context + gui.State.MainContext = contextKey } func (gui *Gui) viewTabNames(viewName string) []string { |