Documentation
¶
Overview ¶
Package ui renders the diffpane Bubble Tea interface and its supporting views.
Index ¶
- Variables
- func HighlightCode(code, filename string) string
- func InitTheme()
- func RenderDiffView(file *internal.FileDiff, scrollOffset, width, height int, ...) string
- func RenderFooter(followOn bool, notification string, width int) string
- func RenderHeader(dirName string, files []internal.FileDiff, currentIdx, width int) string
- func RenderOverlay(files []internal.FileDiff, cursor, height, width int) string
- type ClearNotificationMsg
- type FilesUpdatedMsg
- type ManualResetFailedMsg
- type ManualResetMsg
- type Model
- type ResetTimeoutMsg
- type ThemeMode
Constants ¶
This section is empty.
Variables ¶
var ( // ColorAdd colors added lines and counters. ColorAdd = lipgloss.AdaptiveColor{Light: "#22863a", Dark: "#56d364"} // ColorDel colors deleted lines and counters. ColorDel = lipgloss.AdaptiveColor{Light: "#cb2431", Dark: "#f85149"} // BgAdd colors added-line backgrounds in true-color terminals. // ~3.0:1 contrast vs black; luminance-matched with BgDel. BgAdd = lipgloss.AdaptiveColor{Light: "#dafbe1", Dark: "#286432"} // BgDel colors deleted-line backgrounds in true-color terminals. // ~2.9:1 contrast vs black; luminance-matched with BgAdd. BgDel = lipgloss.AdaptiveColor{Light: "#ffebe9", Dark: "#903c3c"} // ColorDim colors neutral metadata such as headers and footer text. ColorDim = lipgloss.AdaptiveColor{Light: "#6a737d", Dark: "#8b949e"} // StyleAdd renders added content. StyleAdd = lipgloss.NewStyle().Foreground(ColorAdd) // StyleDel renders deleted content. StyleDel = lipgloss.NewStyle().Foreground(ColorDel) // StyleDim renders neutral metadata. StyleDim = lipgloss.NewStyle().Foreground(ColorDim) )
Functions ¶
func HighlightCode ¶ added in v0.2.0
HighlightCode applies chroma syntax colors to one code fragment. It returns the original content for empty input or unsupported file types.
func InitTheme ¶ added in v0.2.0
func InitTheme()
InitTheme resolves the terminal theme once at startup. Call before starting the Bubble Tea program. Reads DIFFPANE_THEME env var (light|dark) to override auto-detection.
func RenderDiffView ¶
func RenderDiffView(file *internal.FileDiff, scrollOffset, width, height int, highlightSet map[lineKey]bool) string
RenderDiffView renders the current file diff within the viewport.
func RenderFooter ¶
RenderFooter renders the one-line footer or a transient notification.
func RenderHeader ¶
RenderHeader renders the single-line top bar.
Types ¶
type ClearNotificationMsg ¶
type ClearNotificationMsg struct {
Token int
}
ClearNotificationMsg clears a temporary footer notification. Token must match the active notification generation; stale clears are ignored.
type FilesUpdatedMsg ¶
FilesUpdatedMsg notifies the UI that the computed file list changed.
type ManualResetFailedMsg ¶ added in v0.2.0
type ManualResetFailedMsg struct {
Error string
}
ManualResetFailedMsg carries a reset error back into the Update loop.
type ManualResetMsg ¶ added in v0.2.0
ManualResetMsg carries the result of a manual baseline reset (r key).
type Model ¶
type Model struct {
DirName string
RepoDir string
BaselineSHA string
Files []internal.FileDiff
CurrentIdx int
FollowOn bool
ScrollOffset int
Notification string
OverlayOpen bool
OverlayCursor int
OverlaySnapshot []internal.FileDiff
OverlayFollowWas bool
PendingUpdate *FilesUpdatedMsg
// ResetBaseline resets the session baseline asynchronously from a tea.Cmd.
ResetBaseline func() (string, []internal.FileDiff, error)
Width int
Height int
// contains filtered or unexported fields
}
Model is the root Bubble Tea model for diffpane.
type ResetTimeoutMsg ¶ added in v0.2.0
type ResetTimeoutMsg struct{}
ResetTimeoutMsg cancels a pending manual baseline reset after timeout.