Documentation
¶
Overview ¶
Package gitdiff implements the diff viewer panel for the grut TUI. It displays file diffs with syntax-highlighted additions and deletions, supporting both inline (unified) and side-by-side view modes.
Index ¶
- type GitDiff
- func (d *GitDiff) Init(ctx context.Context) tea.Cmd
- func (d *GitDiff) KeyBindings() []panels.KeyBinding
- func (d *GitDiff) SetActionsCfg(cfg config.ActionsConfig)
- func (d *GitDiff) SetDiffs(diffs []git.FileDiff)
- func (d *GitDiff) SetSize(width, height int)
- func (d *GitDiff) Title() string
- func (d *GitDiff) Update(msg tea.Msg) (panels.Panel, tea.Cmd)
- func (d *GitDiff) View(width, height int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitDiff ¶
GitDiff is the diff viewer panel. It displays file diffs with syntax-highlighted additions/deletions in inline or side-by-side format.
func New ¶
func New(gitClient git.StatusReader, th *theme.Theme) *GitDiff
New creates a new GitDiff panel. gitClient may be nil (the panel will show an error until a client is available). th may be nil (fallback colors are used).
func (*GitDiff) KeyBindings ¶
func (d *GitDiff) KeyBindings() []panels.KeyBinding
KeyBindings implements panels.Panel.
func (*GitDiff) SetActionsCfg ¶
func (d *GitDiff) SetActionsCfg(cfg config.ActionsConfig)
SetActionsCfg stores the right-click context menu configuration.
func (*GitDiff) SetDiffs ¶
SetDiffs directly injects diff data without a git client, primarily for testing. It resets scroll and rebuilds rendered lines.
func (*GitDiff) SetSize ¶
SetSize implements panels.Panel. Overrides BasePanel to trigger a re-render when dimensions change (side-by-side needs width info).
func (*GitDiff) Title ¶
Title implements panels.Panel. Returns a dynamic title showing the current file, or "gitdiff" when no file is selected.