Skip to content

Commit ac0c3db

Browse files
authored
Fix wrong inactive highlight when switching between repos (#4621)
- **PR Description** When switching between repos, each repo might have a different focused panel; in this case, the previously focused panel would show the "inactive" highlight. By default this is only bold text, so it's barely noticeable, but it becomes more pronounced when setting e.g. ```yml gui: theme: inactiveViewSelectedLineBgColor: - "#666666" ``` I noticed this especially when entering or leaving submodules; for example, enter a submodule by pressing enter in the Files panel, then switch to the Commits panel in the submodule, then press Esc to go back to the parent repo. This would put the focus back into the Files panel, but keep the inactive highlight in the Commits panel.
2 parents ac7de7e + f185e1a commit ac0c3db

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/gui/gui.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,13 @@ func (gui *Gui) checkForChangedConfigsThatDontAutoReload(oldConfig *config.UserC
523523
// resetState reuses the repo state from our repo state map, if the repo was
524524
// open before; otherwise it creates a new one.
525525
func (gui *Gui) resetState(startArgs appTypes.StartArgs) types.Context {
526+
// Un-highlight the current view if there is one. The reason we do this is
527+
// that the repo we are switching to might have a different view focused,
528+
// and would then show an inactive highlight for the previous view.
529+
if oldCurrentView := gui.g.CurrentView(); oldCurrentView != nil {
530+
oldCurrentView.Highlight = false
531+
}
532+
526533
worktreePath := gui.git.RepoPaths.WorktreePath()
527534

528535
if state := gui.RepoStateMap[Repo(worktreePath)]; state != nil {

0 commit comments

Comments
 (0)