From bd9d68dfe1f7626ccc9b2d6c34fad35f3437ff35 Mon Sep 17 00:00:00 2001 From: David Florness Date: Sat, 30 Jan 2021 11:27:38 -0500 Subject: [PATCH] We don't need to SetFocus after calling SetRoot with the same thing That's already done here: https://github.com/rivo/tview/blob/fe953220389fed743d3d5ee872695abab0ae68e0/application.go#L646 --- ui/tui.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/tui.go b/ui/tui.go index 3eb6195..8764e00 100644 --- a/ui/tui.go +++ b/ui/tui.go @@ -60,7 +60,7 @@ func TUI(client *mautrix.Client, elections *election.ElectionsMap) (el *election app.Stop() el = RoomTUI(client, resp.JoinedRooms[i], elections) }) - if err := app.SetRoot(list, true).SetFocus(list).Run(); err != nil { + if err := app.SetRoot(list, true).Run(); err != nil { panic(err) } return @@ -149,7 +149,7 @@ func RoomTUI(client *mautrix.Client, roomID id.RoomID, elections *election.Elect } ElectionTUI(client, el) }) - if err := app.SetRoot(list, true).SetFocus(list).Run(); err != nil { + if err := app.SetRoot(list, true).Run(); err != nil { panic(err) } return @@ -183,7 +183,7 @@ func joinElectionConfirmation(el *election.Election) (shouldJoin bool) { shouldJoin = false } }) - if err := app.SetRoot(modal, false).SetFocus(modal).Run(); err != nil { + if err := app.SetRoot(modal, false).Run(); err != nil { panic(err) } return @@ -224,7 +224,7 @@ func CreateElectionTUI() (title string, candidates []election.Candidate) { AddButton("-", minus). AddButton("Done", done) form.SetTitle("Create an election").SetBorder(true) - if err := app.SetRoot(form, true).SetFocus(form).Run(); err != nil { + if err := app.SetRoot(form, true).Run(); err != nil { panic(err) } if !hitSubmit { @@ -288,7 +288,7 @@ func ElectionTUI(client *mautrix.Client, el *election.Election) { time.Sleep(1 * time.Second) } }() - if err := app.SetRoot(frame, true).SetFocus(frame).Run(); err != nil { + if err := app.SetRoot(frame, true).Run(); err != nil { panic(err) } @@ -331,7 +331,7 @@ func Vote(candidates []election.Candidate) []byte { } }) - if err := app.SetRoot(form, true).SetFocus(form).Run(); err != nil { + if err := app.SetRoot(form, true).Run(); err != nil { panic(err) } -- 2.38.4