Documentation
¶
Overview ¶
Package preview implements the file preview panel for the grut TUI. It provides syntax-highlighted code display, markdown rendering, binary file detection, and a scrollable viewport.
Index ¶
- type Preview
- func (p *Preview) Blur()
- func (p *Preview) FilePath() string
- func (p *Preview) Focus()
- func (p *Preview) Init(_ context.Context) tea.Cmd
- func (p *Preview) KeyBindings() []panels.KeyBinding
- func (p *Preview) SetGitClient(gc git.StatusReader)
- func (p *Preview) SetSize(width, height int)
- func (p *Preview) Title() string
- func (p *Preview) Update(msg tea.Msg) (panels.Panel, tea.Cmd)
- func (p *Preview) View(width, height int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preview ¶
type Preview struct {
// contains filtered or unexported fields
}
Preview is the file preview panel. It displays syntax-highlighted source code, rendered markdown, or file metadata for binary/oversized files.
func New ¶
func New(cfg config.PreviewConfig) *Preview
New creates a new Preview panel with the given configuration.
func (*Preview) FilePath ¶
FilePath returns the path of the currently displayed file (empty if none).
func (*Preview) KeyBindings ¶
func (p *Preview) KeyBindings() []panels.KeyBinding
KeyBindings implements panels.Panel.
func (*Preview) SetGitClient ¶
func (p *Preview) SetGitClient(gc git.StatusReader)
SetGitClient configures the git client for diff-aware preview.
func (*Preview) Title ¶
Title implements panels.Panel. Returns the filename when a file is loaded, the GitHub item title when in ghMode, or "preview" when nothing is selected.