tui

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 27 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, 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

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) WithInitialFile added in v0.6.0

func (m Model) WithInitialFile(path string, line int) Model

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

func (m Model) WithInitialFocusPanel(name string) Model

WithInitialFocusPanel returns a copy of the model configured to focus the named panel after initial startup messages are queued.

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

Jump to

Keyboard shortcuts

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