1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-10 22:42:00 +02:00

use constants

This commit is contained in:
Jesse Duffield
2020-08-23 10:31:19 +10:00
parent 4198bbae6c
commit f876d8fdc8

View File

@@ -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 // 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 // other views can have their context changed directly but this function helps
// keep the main and secondary views in sync // keep the main and secondary views in sync
func (gui *Gui) changeMainViewsContext(context string) { func (gui *Gui) changeMainViewsContext(contextKey string) {
if gui.State.MainContext == context { if gui.State.MainContext == contextKey {
return return
} }
switch context { switch contextKey {
case "normal", "patchBuilding", "staging", "merging": case MAIN_NORMAL_CONTEXT_KEY, MAIN_PATCH_BUILDING_CONTEXT_KEY, MAIN_STAGING_CONTEXT_KEY, MAIN_MERGING_CONTEXT_KEY:
gui.getMainView().Context = context gui.getMainView().Context = contextKey
gui.getSecondaryView().Context = context gui.getSecondaryView().Context = contextKey
default: 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 { func (gui *Gui) viewTabNames(viewName string) []string {