content

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentSource

type ContentSource int

ContentSource identifies a source of content in the panel. This prepares for future split-panel support while currently only one source is displayed at a time.

const (
	SourceNone ContentSource = iota
	SourceFile               // File viewer or diff
	SourceAI                 // AI terminal
)

type FileWithDiffMsg

type FileWithDiffMsg struct {
	Path    string
	Diff    string
	Content string
	HasDiff bool
	Err     error
}

FileWithDiffMsg is sent after checking if a file has a diff.

type LaunchAIMsg

type LaunchAIMsg struct {
	Command string   // e.g., "claude"
	Args    []string // e.g., []string{}
}

LaunchAIMsg requests launching the AI assistant.

type Mode

type Mode int

Mode determines what the content pane displays.

const (
	ModeViewer Mode = iota
	ModeDiff
	ModeTerminal
	ModeAI
)

func (Mode) String

func (m Mode) String() string

type Model

type Model struct {
	components.Base
	// contains filtered or unexported fields
}

Model is the content pane component that routes between different views.

func New

func New() Model

New creates a new content pane model.

func (Model) AICommandName

func (m Model) AICommandName() string

AICommandName returns the capitalized AI command name (e.g., "Claude", "Aider").

func (Model) ActiveSource

func (m Model) ActiveSource() ContentSource

ActiveSource returns the currently active content source.

func (Model) Blur

func (m Model) Blur() Model

Blur removes focus from this component.

func (Model) ContentView

func (m Model) ContentView() string

ContentView returns just the inner content without any title or border. This is used by app.go to wrap content with the new border system.

func (Model) CurrentPath

func (m Model) CurrentPath() string

CurrentPath returns the current file path (if any).

func (Model) Focus

func (m Model) Focus() (Model, tea.Cmd)

Focus gives focus to this component.

func (Model) HasActiveSearch

func (m Model) HasActiveSearch() bool

HasActiveSearch returns whether the viewer has an active search.

func (Model) HasMultipleSources

func (m Model) HasMultipleSources() bool

HasMultipleSources returns true if both file and AI content are available.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the content pane.

func (Model) IsTerminalRunning

func (m Model) IsTerminalRunning() bool

IsTerminalRunning returns true if the terminal is running a process.

func (Model) Mode

func (m Model) Mode() Mode

Mode returns the current mode.

func (Model) ScrollPercent

func (m Model) ScrollPercent() float64

ScrollPercent returns the scroll position of the current view.

func (*Model) SetGitProvider

func (m *Model) SetGitProvider(provider git.Provider)

SetGitProvider sets the git provider for diff functionality.

func (*Model) SetMode

func (m *Model) SetMode(mode Mode)

SetMode sets the display mode.

func (Model) SetSize

func (m Model) SetSize(width, height int) Model

SetSize updates the component's dimensions.

func (Model) SourcesInfo

func (m Model) SourcesInfo() []SourceInfo

SourcesInfo returns information about all available content sources. This enables the dual-header display showing both file and AI titles. Returns a slice of SourceInfo for sources that have content.

func (Model) TitleInfo

func (m Model) TitleInfo() (title string, scrollPercent float64)

TitleInfo returns the title text and scroll percent for the current mode.

func (Model) Update

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

Update handles messages.

func (Model) View

func (m Model) View() string

View renders the content pane.

type OpenFileMsg

type OpenFileMsg struct {
	Path string
}

OpenFileMsg requests opening a file in the viewer.

type SetModeMsg

type SetModeMsg struct {
	Mode Mode
}

SetModeMsg changes the content pane mode.

type SourceInfo

type SourceInfo struct {
	Source        ContentSource
	Title         string  // Display title (filename or AI command name)
	ScrollPercent float64 // -1 for terminals
	IsRunning     bool    // For AI: whether process is running
	IsActive      bool    // Whether this source is currently displayed
}

SourceInfo contains information about a content source for header display.

type SwitchSourceMsg

type SwitchSourceMsg struct {
	Source ContentSource
}

SwitchSourceMsg requests switching to a different content source. Used when clicking on headers in the dual-header display.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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