Documentation
¶
Overview ¶
Package tui implements the terminal user interface for grut using Bubble Tea v2, Lip Gloss v2, and Bubbles v2.
Index ¶
- type Model
- func (m Model) Init() tea.Cmd
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() tea.View
- func (m Model) WithChat(c *chat.Model) Model
- func (m Model) WithConfig(cfg *config.Config) Model
- func (m Model) WithGitClient(gc git.GitClient) Model
- func (m Model) WithInitialFile(path string, line int) Model
- func (m Model) WithInitialFocusPanel(name string) Model
- func (m Model) WithSessionManager(mgr *session.Manager) Model
- func (m Model) WithUndoManager(um *git.UndoManager) Model
- type OverlayCreator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the top-level TUI model for grut. It composes panels via the layout engine, routes keyboard events, and renders the final view.
func New ¶
func New(engine layout.PanelManager, th *theme.Theme, km *keymap.Keymap, bmMgr *bm.Manager, overlays OverlayCreator) Model
New creates a new TUI model with the given panel manager, theme, keymap, and bookmark manager. The panel manager is typically a *layout.Engine but can be any implementation of layout.PanelManager.
func (Model) Init ¶
Init implements tea.Model. Initializes all panels and starts the auto-fetch timer if configured.
func (Model) Update ¶
Update implements tea.Model. Routes messages to the layout engine and handles global key bindings.
func (Model) View ¶
View implements tea.Model. Composes all panels and the status bar into the final view. F27: overlay notifications on top of the panel layout.
func (Model) WithChat ¶
WithChat returns a copy of the model with the given chat model attached as a footer. When non-nil, the chat footer is rendered below the panel area and can receive keyboard focus via ctrl+space.
func (Model) WithConfig ¶
WithConfig returns a copy of the model with the given configuration. Used for auto-fetch interval and sign-commits settings.
func (Model) WithGitClient ¶
WithGitClient returns a copy of the model with the given git client configured for app-level operations (commit, push, pull, fetch).
func (Model) WithInitialFile ¶ added in v0.6.0
WithInitialFile returns a copy of the model configured to open the given file in the preview panel at startup, focusing the preview and scrolling to the given 1-based line (0 = top). Used when grut is launched with a file path argument, e.g. "grut main.go:42". An empty path is a no-op.
func (Model) WithInitialFocusPanel ¶ added in v0.7.0
WithInitialFocusPanel returns a copy of the model configured to focus the named panel after initial startup messages are queued.
func (Model) WithSessionManager ¶
WithSessionManager returns a copy of the model with the given session manager configured. When set, the current session state is saved to disk on quit and restored on the next launch.
func (Model) WithUndoManager ¶
func (m Model) WithUndoManager(um *git.UndoManager) Model
WithUndoManager returns a copy of the model with the given UndoManager configured. When set, ctrl+z and ctrl+y trigger undo/redo operations.
type OverlayCreator ¶ added in v0.3.4
type OverlayCreator interface {
NewBookmarkPanel() panels.Panel
NewCommandLogPanel() panels.Panel
NewHelpPanel() panels.Panel
NewWelcomePanel() panels.Panel
NewSettingsPanel(currentPos layout.PreviewPosition, currentTheme string, themeNames []string, actionsCfg config.ActionsConfig) panels.Panel
NewFuzzyFinder(mode string, bindings []keymap.Binding) panels.Panel
NewTextSearch() panels.Panel
}
OverlayCreator abstracts overlay panel construction so that the tui package does not import concrete overlay panel packages (bookmarks, fuzzyfinder, help, settings, welcome) directly.