fix: limit the height and width of flex

This commit fixes the issue where the app was using
the full height of the terminal screen.

The fix include setting the 'fullscreen' boolean to
false and explicity defining the size using SetRect.
This commit is contained in:
Dan Anglin 2020-01-20 20:29:45 +00:00
parent 1d79a4c7e6
commit 0a2b9c483e
No known key found for this signature in database
GPG key ID: 7AC2B18EC1D09F27
2 changed files with 2 additions and 1 deletions

View file

@ -84,7 +84,7 @@ func main() {
flex := newFlex(infoUI, timerUI) flex := newFlex(infoUI, timerUI)
go pominal.Run(infoUI, timerUI) go pominal.Run(infoUI, timerUI)
if err := app.SetRoot(flex, true).SetFocus(flex).Run(); err != nil { if err := app.SetRoot(flex, false).SetFocus(flex).Run(); err != nil {
panic(err) panic(err)
} }
} }

1
ui.go
View file

@ -44,6 +44,7 @@ func newTimerUI(app *tview.Application) *tview.TextView {
func newFlex(info, timer *tview.TextView) *tview.Flex { func newFlex(info, timer *tview.TextView) *tview.Flex {
f := tview.NewFlex().AddItem(info, 30, 1, false).AddItem(timer, 50, 1, false) f := tview.NewFlex().AddItem(info, 30, 1, false).AddItem(timer, 50, 1, false)
f.SetRect(0, 0, 80, 20)
return f return f
} }