diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-03 11:32:14 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 19:34:32 +1000 |
commit | bc9a99387f68afb24863d17ab4d29c1686843a76 (patch) | |
tree | aac694046f93d457177086d4c5afb5a0c12ea302 /pkg | |
parent | 5289d49f75e9735f129e1f8e2a2f9dc74373515b (diff) |
refactor of contexts and filtering
Diffstat (limited to 'pkg')
35 files changed, 295 insertions, 330 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 27c2d693c..956b67e96 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -69,7 +69,7 @@ func (gui *Gui) refreshBranches() { } gui.State.Branches = builder.Build() - if err := gui.postRefreshUpdate(gui.Contexts.Branches.Context); err != nil { + if err := gui.postRefreshUpdate(gui.Contexts.Branches); err != nil { gui.Log.Error(err) } @@ -507,8 +507,8 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error { context.GetPanelState().SetSelectedLineIdx(0) } - if context.GetKey() != gui.Contexts.Branches.Context.GetKey() { - if err := gui.pushContext(gui.Contexts.Branches.Context); err != nil { + if context.GetKey() != gui.Contexts.Branches.GetKey() { + if err := gui.pushContext(gui.Contexts.Branches); err != nil { return err } } diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index c72ee3b13..626fe173c 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -107,7 +107,7 @@ func (gui *Gui) refreshCommitFilesView() error { } gui.State.CommitFileManager.SetFiles(files, to) - return gui.postRefreshUpdate(gui.Contexts.CommitFiles.Context) + return gui.postRefreshUpdate(gui.Contexts.CommitFiles) } func (gui *Gui) handleOpenOldCommitFile() error { @@ -167,7 +167,7 @@ func (gui *Gui) handleToggleFileForPatch() error { gui.GitCommand.PatchManager.Reset() } - return gui.postRefreshUpdate(gui.Contexts.CommitFiles.Context) + return gui.postRefreshUpdate(gui.Contexts.CommitFiles) } if gui.GitCommand.PatchManager.Active() && gui.GitCommand.PatchManager.To != gui.State.CommitFileManager.GetParent() { @@ -215,7 +215,7 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error { } } - if err := gui.pushContext(gui.Contexts.PatchBuilding.Context); err != nil { + if err := gui.pushContext(gui.Contexts.PatchBuilding); err != nil { return err } return gui.handleRefreshPatchBuildingPanel(selectedLineIdx) @@ -231,7 +231,7 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error { return enterTheFile(selectedLineIdx) }, handleClose: func() error { - return gui.pushContext(gui.Contexts.CommitFiles.Context) + return gui.pushContext(gui.Contexts.CommitFiles) }, }) } @@ -247,7 +247,7 @@ func (gui *Gui) handleToggleCommitFileDirCollapsed() error { gui.State.CommitFileManager.ToggleCollapsed(node.GetPath()) - if err := gui.postRefreshUpdate(gui.Contexts.CommitFiles.Context); err != nil { + if err := gui.postRefreshUpdate(gui.Contexts.CommitFiles); err != nil { gui.Log.Error(err) } @@ -262,14 +262,14 @@ func (gui *Gui) switchToCommitFilesContext(refName string, canRebase bool, conte gui.State.Panels.CommitFiles.SelectedLineIdx = 0 gui.State.Panels.CommitFiles.refName = refName gui.State.Panels.CommitFiles.canRebase = canRebase - gui.Contexts.CommitFiles.Context.SetParentContext(context) - gui.Contexts.CommitFiles.Context.SetWindowName(windowName) + gui.Contexts.CommitFiles.SetParentContext(context) + gui.Contexts.CommitFiles.SetWindowName(windowName) if err := gui.refreshCommitFilesView(); err != nil { return err } - return gui.pushContext(gui.Contexts.CommitFiles.Context) + return gui.pushContext(gui.Contexts.CommitFiles) } // NOTE: this is very similar to handleToggleFileTreeView, could be DRY'd with generics @@ -283,12 +283,12 @@ func (gui *Gui) handleToggleCommitFileTreeView() error { gui.State.CommitFileManager.ExpandToPath(path) index, found := gui.State.CommitFileManager.GetIndexForPath(path) if found { - gui.commitFilesListContext().GetPanelState().SetSelectedLineIdx(index) + gui.Contexts.CommitFiles.GetPanelState().SetSelectedLineIdx(index) } } if gui.getCommitFilesView().Context == COMMIT_FILES_CONTEXT_KEY { - if err := gui.Contexts.CommitFiles.Context.HandleRender(); err != nil { + if err := gui.Contexts.CommitFiles.HandleRender(); err != nil { return err } } diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 811c8613d..8edcc642d 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -12,7 +12,7 @@ import ( func (gui *Gui) getSelectedLocalCommit() *models.Commit { selectedLine := gui.State.Panels.Commits.SelectedLineIdx - if selectedLine == -1 { + if selectedLine == -1 || selectedLine > len(gui.State.Commits)-1 { return nil } @@ -38,7 +38,7 @@ func (gui *Gui) handleCommitSelect() error { task = gui.createRenderStringTask(gui.Tr.NoCommitsThisBranch) } else { cmd := gui.OSCommand.ExecutableFromString( - gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.Modes.Filtering.Path), + gui.GitCommand.ShowCmdStr(commit.Sha, gui.State.Modes.Filtering.GetPath()), ) task = gui.createRunPtyTask(cmd) } @@ -86,7 +86,7 @@ func (gui *Gui) refreshCommits() error { go utils.Safe(func() { _ = gui.refreshCommitsWithLimit() - context, ok := gui.Contexts.CommitFiles.Context.GetParentContext() + context, ok := gui.Contexts.CommitFiles.GetParentContext() if ok && context.GetKey() == BRANCH_COMMITS_CONTEXT_KEY { // This makes sense when we've e.g. just amended a commit, meaning we get a new commit SHA at the same position. // However if we've just added a brand new commit, it pushes the list down by one and so we would end up @@ -117,7 +117,7 @@ func (gui *Gui) refreshCommitsWithLimit() error { commits, err := builder.GetCommits( commands.GetCommitsOptions{ Limit: gui.State.Panels.Commits.LimitCommits, - FilterPath: gui.State.Modes.Filtering.Path, + FilterPath: gui.State.Modes.Filtering.GetPath(), IncludeRebaseCommits: true, RefName: "HEAD", }, @@ -127,7 +127,7 @@ func (gui *Gui) refreshCommitsWithLimit() error { } gui.State.Commits = commits - return gui.postRefreshUpdate(gui.Contexts.BranchCommits.Context) + return gui.postRefreshUpdate(gui.Contexts.BranchCommits) } func (gui *Gui) refreshRebaseCommits() error { @@ -142,7 +142,7 @@ func (gui *Gui) refreshRebaseCommits() error { } gui.State.Commits = updatedCommits - return gui.postRefreshUpdate(gui.Contexts.BranchCommits.Context) + return gui.postRefreshUpdate(gui.Contexts.BranchCommits) } // specific functions @@ -444,7 +444,7 @@ func (gui *Gui) handleViewCommitFiles() error { return nil } - return gui.switchToCommitFilesContext(commit.Sha, true, gui.Contexts.BranchCommits.Context, "commits") + return gui.switchToCommitFilesContext(commit.Sha, true, gui.Contexts.BranchCommits, "commits") } func (gui *Gui) handleCreateFixupCommit() error { diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 74c4cc9d6..c52a32ce3 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -204,7 +204,7 @@ func (gui *Gui) prepareConfirmationPanel(title, prompt string, hasLoader bool, f } gui.g.Update(func(g *gocui.Gui) error { - return gui.pushContext(gui.Contexts.Confirmation.Context) + return gui.pushContext(gui.Contexts.Confirmation) }) return confirmationView, nil } @@ -284,7 +284,7 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { { viewName: "confirmation", key: gui.getKey(keybindingConfig.Universal.TogglePanel), - handler: func() error { return gui.replaceContext(gui.Contexts.Suggestions.Context) }, + handler: func() error { return gui.replaceContext(gui.Contexts.Suggestions) }, }, { viewName: "suggestions", @@ -304,7 +304,7 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error { { viewName: "suggestions", key: gui.getKey(keybindingConfig.Universal.TogglePanel), - handler: func() error { return gui.replaceContext(gui.Contexts.Confirmation.Context) }, + handler: func() error { return gui.replaceContext(gui.Contexts.Confirmation) }, }, } diff --git a/pkg/gui/context.go b/pkg/gui/context.go index d76747d74..8b2015711 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -65,62 +65,54 @@ var allContextKeys = []string{ SUGGESTIONS_CONTEXT_KEY, } -type SimpleContextNode struct { - Context Context -} - -type RemotesContextNode struct { - Context Context - Branches SimpleContextNode -} - type ContextTree struct { - Status SimpleContextNode - Files SimpleContextNode - Submodules SimpleContextNode - Menu SimpleContextNode - Branches SimpleContextNode - Remotes RemotesContextNode - Tags SimpleContextNode - BranchCommits SimpleContextNode - CommitFiles SimpleContextNode - ReflogCommits SimpleContextNode - SubCommits SimpleContextNode - Stash SimpleContextNode - Normal SimpleContextNode - Staging SimpleContextNode - PatchBuilding SimpleContextNode - Merging SimpleContextNode - Credentials SimpleContextNode - Confirmation SimpleContextNode - CommitMessage SimpleContextNode - Search SimpleContextNode - Suggestions SimpleContextNode + Status Context + Files *ListContext + Submodules *ListContext + Menu *ListContext + Branches *ListContext + Remotes *ListContext + RemoteBranches *ListContext + Tags *ListContext + BranchCommits *ListContext + CommitFiles *ListContext + ReflogCommits *ListContext + SubCommits *ListContext + Stash *ListContext + Suggestions *ListContext + Normal Context + Staging Context + PatchBuilding Context + Merging Context + Credentials Context + Confirmation Context + CommitMessage Context + Search Context } func (gui *Gui) allContexts() []Context { return []Context{ - gui.Contexts.Status.Context, - gui.Contexts.Files.Context, - gui.Contexts.Submodules.Context, - gui.Contexts.Branches.Context, - gui.Contexts.Remotes.Context, - gui.Contexts.Remotes.Branches.Context, - gui.Contexts.Tags.Context, - gui.Contexts.BranchCommits.Context, - gui.Contexts.CommitFiles.Context, - gui.Contexts.ReflogCommits.Context, - gui.Contexts.Stash.Context, - gui.Contexts.Menu.Context, - gui.Contexts.Confirmation.Context, - gui.Contexts.Credentials.Context, - gui.Contexts.CommitMessage.Context, - gui.Contexts.Normal.Context, - gui.Contexts.Staging.Context, - gui.Contexts.Merging.Context, - gui.Contexts.PatchBuilding.Context, - gui.Contexts.SubCommits.Context, - gui.Contexts.Suggestions.Context, + gui.Contexts.Status, + gui.Contexts.Files, + gui.Contexts.Submodules, + gui.Contexts.Branches, + gui.Contexts.Remotes, + gui.Contexts.RemoteBranches, + gui.Contexts.Tags, + gui.Contexts.BranchCommits, + gui.Contexts.CommitFiles, + gui.Contexts.ReflogCommits, + gui.Contexts.Stash, + gui.Contexts.Menu, + gui.Contexts.Confirmation, + gui.Contexts.Credentials, + gui.Contexts.CommitMessage, + gui.Contexts.Normal, + gui.Contexts.Staging, + gui.Contexts.Merging, + gui.Contexts.PatchBuilding, + gui.Contexts.SubCommits, + gui.Contexts.Suggestions, } } @@ -206,145 +198,101 @@ func (c BasicContext) GetKey() string { func (gui *Gui) contextTree() ContextTree { return ContextTree{ - Status: SimpleContextNode{ - Context: BasicContext{ - OnFocus: gui.handleStatusSelect, - Kind: SIDE_CONTEXT, - ViewName: "status", - Key: STATUS_CONTEXT_KEY, - }, - }, - Files: SimpleContextNode{ - Context: gui.filesListContext(), - }, - Submodules: SimpleContextNode{ - Context: gui.submodulesListContext(), - }, - Menu: SimpleContextNode{ - Context: gui.menuListContext(), - }, - Remotes: RemotesContextNode{ - Context: gui.remotesListContext(), - Branches: SimpleContextNode{ - Context: gui.remoteBranchesListContext(), - }, - }, - BranchCommits: SimpleContextNode{ - Context: gui.branchCommitsListContext(), - }, - CommitFiles: SimpleContextNode{ - Context: gui.commitFilesListContext(), - }, - ReflogCommits: SimpleContextNode{ - Context: gui.reflogCommitsListContext(), - }, - SubCommits: SimpleContextNode{ - Context: gui.subCommitsListContext(), + Status: BasicContext{ + OnFocus: gui.handleStatusSelect, + Kind: SIDE_CONTEXT, + ViewName: "status", + Key: STATUS_CONTEXT_KEY, }, - Branches: SimpleContextNode{ - Context: gui.branchesListContext(), - }, - Tags: SimpleContextNode{ - Context: gui.tagsListContext(), - }, - Stash: SimpleContextNode{ - Context: gui.stashListContext(), - }, - Normal: SimpleContextNode{ - Context: BasicContext{ - OnFocus: func() error { - return nil // TODO: should we do something here? We should allow for scrolling the panel - }, - Kind: MAIN_CONTEXT, - ViewName: "main", - Key: MAIN_NORMAL_CONTEXT_KEY, - }, - }, - Staging: SimpleContextNode{ - Context: BasicContext{ - OnFocus: func() error { - return nil - // TODO: centralise the code here - // return gui.refreshStagingPanel(false, -1) - }, - Kind: MAIN_CONTEXT, - ViewName: "main", - Key: MAIN_STAGING_CONTEXT_KEY, + Files: gui.filesListContext(), + Submodules: gui.submodulesListContext(), + Menu: gui.menuListContext(), + Remotes: gui.remotesListContext(), + RemoteBranches: gui.remoteBranchesListContext(), + BranchCommits: gui.branchCommitsListContext(), + CommitFiles: gui.commitFilesListContext(), + ReflogCommits: gui.reflogCommitsListContext(), + SubCommits: gui.subCommitsListContext(), + Branches: gui.branchesListContext(), + Tags: gui.tagsListContext(), + Stash: gui.stashListContext(), + Normal: BasicContext{ + OnFocus: func() error { + return nil // TODO: should we do something here? We should allow for scrolling the panel }, + Kind: MAIN_CONTEXT, + ViewName: "main", + Key: MAIN_NORMAL_CONTEXT_KEY, }, - PatchBuilding: SimpleContextNode{ - Context: BasicContext{ - OnFocus: func() error { - return nil - // TODO: centralise the code here - // return gui.refreshPatchBuildingPanel(-1) - }, - Kind: MAIN_CONTEXT, - ViewName: "main", - Key: MAIN_PATCH_BUILDING_CONTEXT_KEY, + Staging: BasicContext{ + OnFocus: func() error { + return nil + // TODO: centralise the code here + // return gui.refreshStagingPanel(false, -1) }, + Kind: MAIN_CONTEXT, + ViewName: "main", + Key: MAIN_STAGING_CONTEXT_KEY, }, - Merging: SimpleContextNode{ - Context: BasicContext{ - OnFocus: gui.refreshMergePanelWithLock, - Kind: MAIN_CONTEXT, - ViewName: "main", - Key: MAIN_MERGING_CONTEXT_KEY, - OnGetOptionsMap: gui.getMergingOptions, + PatchBuilding: BasicContext{ + OnFocus: func() error { + return nil + // TODO: centralise the code here + // return gui.refreshPatchBuildingPanel(-1) }, + Kind: MAIN_CONTEXT, + ViewName: "main", + Key: MAIN_PATCH_BUILDING_CONTEXT_KEY, }, - Credentials: SimpleContextNode{ - Context: BasicContext{ - OnFocus: gui.handleCredentialsViewFocused, - Kind: PERSISTENT_POPUP, - ViewName: "credentials", - Key: CREDENTIALS_CONTEXT_KEY, - }, + Merging: BasicContext{ + OnFocus: gui.refreshMergePanelWithLock, + Kind: MAIN_CONTEXT, + ViewName: "main", + Key: MAIN_MERGING_CONTEXT_KEY, + OnGetOptionsMap: gui.getMergingOptions, }, - Confirmation: SimpleContextNode{ - Context: BasicContext{ - OnFocus: func() error { return nil }, - Kind: TEMPORARY_POPUP, - ViewName: "confirmation", - Key: CONFIRMATION_CONTEXT_KEY, - }, + Credentials: BasicContext{ + OnFocus: gui.handleCredentialsViewFocused, + Kind: PERSISTENT_POPUP, + ViewName: "credentials", + Key: CREDENTIALS_CONTEXT_KEY, }, - Suggestions: SimpleContextNode{ - Context: gui.suggestionsListContext(), + Confirmation: BasicContext{ + OnFocus: func() error { return nil }, + Kind: TEMPORARY_POPUP, + ViewName: "confirmation", + Key: CONFIRMATION_CONTEXT_KEY, }, - CommitMessage: SimpleContextNode{ - Context: BasicContext{ - OnFocus: gui.handleCommitMessageFocused, - Kind: PERSISTENT_POPUP, - ViewName: "commitMessage", - Key: COMMIT_MESSAGE_CONTEXT_KEY, - }, + Suggestions: gui.suggestionsListContext(), + CommitMessage: BasicContext{ + OnFocus: gui.handleCommitMessageFocused, + Kind: PERSISTENT_POPUP, + ViewName: "commitMessage", + Key: COMMIT_MESSAGE_CONTEXT_KEY, }, - Search: SimpleContextNode{ - Context: BasicContext{ - OnFocus: func() error { return nil }, - Kind: PERSISTENT_POPUP, - ViewName: "search", - Key: SEARCH_CONTEXT_KEY, - }, + Search: BasicContext{ + OnFocus: func() error { return nil }, + Kind: PERSISTENT_POPUP, + ViewName: "search", + Key: SEARCH_CONTEXT_KEY, }, } } func (gui *Gui) initialViewContextMap() map[string]Context { return map[string]Context{ - "status": gui.Contexts.Status.Context, - "files": gui.Contexts.Files.Context, - "branches": gui.Contexts.Branches.Context, - "commits": gui.Contexts.BranchCommits.Context, - "commitFiles": gui.Contexts.CommitFiles.Context, - "stash": gui.Contexts.Stash.Context, - "menu": gui.Contexts.Menu.Context, - "confirmation": gui.Contexts.Confirmation.Context, - "credentials": gui.Contexts.Credentials.Context, - "commitMessage": gui.Contexts.CommitMessage.Context, - "main": gui.Contexts.Normal.Context, - "secondary": gui.Contexts.Normal.Context, + "status": gui.Contexts.Status, + "files": gui.Contexts.Files, + "branches": gui.Contexts.Branches, + "commits": gui.Contexts.BranchCommits, + "commitFiles": gui.Contexts.CommitFiles, + "stash": gui.Contexts.Stash, + "menu": gui.Contexts.Menu, + "confirmation": gui.Contexts.Confirmation, + "credentials": gui.Contexts.Credentials, + "commitMessage": gui.Contexts.CommitMessage, + "main": gui.Contexts.Normal, + "secondary": gui.Contexts.Normal, } } @@ -353,41 +301,41 @@ func (gui *Gui) viewTabContextMap() map[string][]tabContext { "branches": { { tab: "Local Branches", - contexts: []Context{gui.Contexts.Branches.Context}, + contexts: []Context{gui.Contexts.Branches}, }, { tab: "Remotes", contexts: []Context{ - gui.Contexts.Remotes.Context, - gui.Contexts.Remotes.Branches.Context, + gui.Contexts.Remotes, + gui.Contexts.RemoteBranches, }, }, { tab: "Tags", - contexts: []Context{gui.Contexts.Tags.Context}, + contexts: []Context{gui.Contexts.Tags}, }, }, "commits": { { tab: "Commits", - contexts: []Context{gui.Contexts.BranchCommits.Context}, + contexts: []Context{gui.Contexts.BranchCommits}, }, { tab: "Reflog", contexts: []Context{ - gui.Contexts.ReflogCommits.Context, + gui.Contexts.ReflogCommits, }, }, }, "files": { { tab: "Files", - contexts: []Context{gui.Contexts.Files.Context}, + contexts: []Context{gui.Contexts.Files}, }, { tab: "Submodules", contexts: []Context{ - gui.Contexts.Submodules.Context, + gui.Contexts.Submodules, }, }, }, @@ -623,7 +571,7 @@ func (gui *Gui) currentSideContext() *ListContext { } func (gui *Gui) defaultSideContext() Context { - return gui.Contexts.Files.Context + return gui.Contexts.Files } func (gui *Gui) setInitialViewContexts() { @@ -684,7 +632,7 @@ func (gui *Gui) onViewFocusLost(v *gocui.View, newView *gocui.View) error { if v.Name() == "commitFiles" && newView.Name() != "main" && newView.Name() != "secondary" { gui.resetWindowForView("commitFiles") - if err := gui.deactivateContext(gui.Contexts.CommitFiles.Context); err != nil { + if err := gui.deactivateContext(gui.Contexts.CommitFiles); err != nil { return err } } diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go index d79d4cf67..2f2585bcf 100644 --- a/pkg/gui/credentials_panel.go +++ b/pkg/gui/credentials_panel.go @@ -26,7 +26,7 @@ func (gui *Gui) promptUserForCredential(passOrUname string) string { credentialsView.Mask = '*' } - if err := gui.pushContext(gui.Contexts.Credentials.Context); err != nil { + if err := gui.pushContext(gui.Contexts.Credentials); err != nil { return err } diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index 5bce9fe44..bd29664fe 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -94,7 +94,7 @@ func (gui *Gui) diffStr() string { if file != "" { output += " -- " + file } else if gui.State.Modes.Filtering.Active() { - output += " -- " + gui.State.Modes.Filtering.Path + output += " -- " + gui.State.Modes.Filtering.GetPath() } return output diff --git a/pkg/gui/errors.go b/pkg/gui/errors.go index e0f37d3ea..651b964c2 100644 --- a/pkg/gui/errors.go +++ b/pkg/gui/errors.go @@ -26,7 +26,6 @@ func (gui *Gui) GenerateSentinelErrors() { gui.Errors = SentinelErrors{ ErrNoFiles: errors.New(gui.Tr.NoChangedFiles), ErrSwitchRepo: errors.New("switching repo"), - ErrRestart: errors.New("restarting"), } } @@ -34,6 +33,5 @@ func (gui *Gui) sentinelErrorsArr() []error { return []error{ gui.Errors.ErrNoFiles, gui.Errors.ErrSwitchRepo, - gui.Errors.ErrRestart, } } diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 59ec172b3..d95875d5e 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -124,13 +124,13 @@ func (gui *Gui) refreshFilesAndSubmodules() error { } gui.g.Update(func(g *gocui.Gui) error { - if err := gui.postRefreshUpdate(gui.Contexts.Submodules.Context); err != nil { + if err := gui.postRefreshUpdate(gui.Contexts.Submodules); err != nil { gui.Log.Error(err) } if gui.getFilesView().Context == FILES_CONTEXT_KEY { // doing this a little custom (as opposed to using gui.postRefreshUpdate) because we handle selecting the file explicitly below - if err := gui.Contexts.Files.Context.HandleRender(); err != nil { |