From 1bfefd61a69f18e8cba4d233e8bc2f1e1031b353 Mon Sep 17 00:00:00 2001 From: tramhao Date: Thu, 28 Jan 2021 14:50:05 +0800 Subject: [PATCH] There is no need to switch focus to playingbar as nothing happens there --- gomu.go | 17 +++++++++++++++++ start.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gomu.go b/gomu.go index a4d3cb4..aa35e18 100644 --- a/gomu.go +++ b/gomu.go @@ -90,6 +90,23 @@ func (g *Gomu) cyclePanels() Panel { return first } +func (g *Gomu) cyclePanels2() Panel { + first :=g.panels[0] + second :=g.panels[1] + if first.HasFocus() { + g.setFocusPanel(second) + g.prevPanel = second + } else if second.HasFocus() { + g.setFocusPanel(first) + g.prevPanel = first + } else { + g.setFocusPanel(first) + g.prevPanel = first + } + + return first +} + // Changes title and border color when focusing panel // and changes color of the previous panel as well func (g *Gomu) setFocusPanel(panel Panel) { diff --git a/start.go b/start.go index 16a88b6..7739019 100644 --- a/start.go +++ b/start.go @@ -228,7 +228,7 @@ func start(application *tview.Application, args Args) { if strings.Contains(popupName, "confirmation-") { return e } - gomu.cyclePanels() + gomu.cyclePanels2() } cmds := map[rune]string{