tui

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package tui implements the terminal user interface for grut using Bubble Tea v2, Lip Gloss v2, and Bubbles v2.

Index

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) 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

func (m Model) Init() tea.Cmd

Init implements tea.Model. Initializes all panels and starts the auto-fetch timer if configured.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model. Routes messages to the layout engine and handles global key bindings.

func (Model) View

func (m Model) View() tea.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

func (m Model) WithChat(c *chat.Model) Model

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

func (m Model) WithConfig(cfg *config.Config) Model

WithConfig returns a copy of the model with the given configuration. Used for auto-fetch interval and sign-commits settings.

func (Model) WithGitClient

func (m Model) WithGitClient(gc git.GitClient) Model

WithGitClient returns a copy of the model with the given git client configured for app-level operations (commit, push, pull, fetch).

func (Model) WithSessionManager

func (m Model) WithSessionManager(mgr *session.Manager) Model

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 OverlayFactory added in v0.2.0

type OverlayFactory struct {
	// contains filtered or unexported fields
}

OverlayFactory constructs overlay panels (bookmarks, fuzzy finder, help, settings, welcome) behind the panels.Panel interface. The root Model uses the factory instead of importing each panel package, reducing coupling.

func NewOverlayFactory added in v0.2.0

func NewOverlayFactory(th *theme.Theme, bmMgr *bm.Manager) *OverlayFactory

NewOverlayFactory creates a factory wired with the shared dependencies that overlay panels need.

func (*OverlayFactory) NewBookmarkPanel added in v0.2.0

func (f *OverlayFactory) NewBookmarkPanel() panels.Panel

NewBookmarkPanel creates the bookmarks overlay panel.

func (*OverlayFactory) NewFuzzyFinder added in v0.2.0

func (f *OverlayFactory) NewFuzzyFinder(mode string, bindings []keymap.Binding) panels.Panel

NewFuzzyFinder creates a fuzzy finder overlay for the given mode. Supported modes: "files", "commands", "directories". The bindings parameter is used for the "commands" mode source.

func (*OverlayFactory) NewHelpPanel added in v0.2.0

func (f *OverlayFactory) NewHelpPanel() panels.Panel

NewHelpPanel creates the help overlay panel.

func (*OverlayFactory) NewSettingsPanel added in v0.2.0

func (f *OverlayFactory) NewSettingsPanel(
	currentPos layout.PreviewPosition,
	currentTheme string,
	themeNames []string,
	actionsCfg config.ActionsConfig,
) panels.Panel

NewSettingsPanel creates the settings overlay panel with the given configuration state.

func (*OverlayFactory) NewWelcomePanel added in v0.2.0

func (f *OverlayFactory) NewWelcomePanel() panels.Panel

NewWelcomePanel creates the welcome overlay panel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL