feat: add navigation and window size handlers with corresponding tests
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/StevanFreeborn/term-tier/internal/state"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
type trackWindowSizeHandler struct{}
|
||||
|
||||
func NewTrackWindowSizeHandler() WinSizeMsgHandler {
|
||||
return trackWindowSizeHandler{}
|
||||
}
|
||||
|
||||
func (h trackWindowSizeHandler) Match(s state.State, msg tea.WindowSizeMsg) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (h trackWindowSizeHandler) Handle(s state.State, msg tea.WindowSizeMsg) tea.Cmd {
|
||||
s.SetWindowSize(msg.Width, msg.Height)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user