~edwargix/tallyard

bd9d68dfe1f7626ccc9b2d6c34fad35f3437ff35 — David Florness 4 years ago 78c5b7d
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
1 files changed, 6 insertions(+), 6 deletions(-)

M ui/tui.go
M ui/tui.go => ui/tui.go +6 -6
@@ 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)
	}