pelican/internal/ui/modeview.go
Dan Anglin 70238291e7
All checks were successful
/ test (pull_request) Successful in 34s
/ lint (pull_request) Successful in 35s
checkpoint: mode view added
- replaced baseFlex with a grid to prevent the need to add more flex
  primitive.
- Added first iteration of the mode view.
2024-01-15 21:54:21 +00:00

35 lines
548 B
Go

package ui
import (
"fmt"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
type modeView struct {
*tview.TextView
format string
}
func newModeView() *modeView {
format := "[white::b]%s[-:-:-:-]"
textView := tview.NewTextView()
textView.SetBackgroundColor(tcell.ColorGrey.TrueColor())
textView.SetTextAlign(tview.AlignLeft)
textView.SetDynamicColors(true)
obj := modeView{
TextView: textView,
format: format,
}
return &obj
}
func (m *modeView) update(mode boardMode) {
m.Clear()
fmt.Fprintf(m, m.format, mode)
}