1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

move context keys into context package

This commit is contained in:
Jesse Duffield
2022-01-29 19:15:46 +11:00
parent 138be04e65
commit e363606fb6
19 changed files with 257 additions and 243 deletions

View File

@ -3,17 +3,18 @@ package gui
import (
"errors"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
var CONTEXT_KEYS_SHOWING_DIFFS = []types.ContextKey{
FILES_CONTEXT_KEY,
COMMIT_FILES_CONTEXT_KEY,
STASH_CONTEXT_KEY,
BRANCH_COMMITS_CONTEXT_KEY,
SUB_COMMITS_CONTEXT_KEY,
MAIN_STAGING_CONTEXT_KEY,
MAIN_PATCH_BUILDING_CONTEXT_KEY,
context.FILES_CONTEXT_KEY,
context.COMMIT_FILES_CONTEXT_KEY,
context.STASH_CONTEXT_KEY,
context.BRANCH_COMMITS_CONTEXT_KEY,
context.SUB_COMMITS_CONTEXT_KEY,
context.MAIN_STAGING_CONTEXT_KEY,
context.MAIN_PATCH_BUILDING_CONTEXT_KEY,
}
func isShowingDiff(gui *Gui) bool {
@ -59,9 +60,9 @@ func (gui *Gui) handleDiffContextSizeChange() error {
currentContext := gui.currentStaticContext()
switch currentContext.GetKey() {
// we make an exception for our staging and patch building contexts because they actually need to refresh their state afterwards.
case MAIN_PATCH_BUILDING_CONTEXT_KEY:
case context.MAIN_PATCH_BUILDING_CONTEXT_KEY:
return gui.handleRefreshPatchBuildingPanel(-1)
case MAIN_STAGING_CONTEXT_KEY:
case context.MAIN_STAGING_CONTEXT_KEY:
return gui.handleRefreshStagingPanel(false, -1)
default:
return currentContext.HandleRenderToMain()