Private
Public Access
1
0

More monior TUI refactor/cleanup

`tui/tui.go` is no longer responsible for passing window resize updates
to all views, instead we request a new window size message to be sent at
the same time we enter the view, allowing the view to catch and handle
it.

Add `Initialized` to `tui/shared/View` model, now we only call
`Init` on a view before entering it for the first time, rather than
calling `Init` on all views when the application starts.

Renames file, small cleanups
This commit is contained in:
2024-09-16 14:04:08 +00:00
parent 7c0bfefc65
commit 24b5cdbbf6
6 changed files with 68 additions and 66 deletions

View File

@@ -5,6 +5,7 @@ import (
)
type Shared struct {
Initialized bool
Width int
Height int
Err error
@@ -29,6 +30,12 @@ type (
MsgError error
)
func ViewEnter() tea.Cmd {
return func() tea.Msg {
return MsgViewEnter{}
}
}
func WrapError(err error) tea.Cmd {
return func() tea.Msg {
return MsgError(err)