components

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalHelpEntries

func GlobalHelpEntries() map[string][]HelpEntry

GlobalHelpEntries returns the help entries for global keybindings.

func RenderHelp

func RenderHelp(styles ui.Styles, title string, sections map[string][]HelpEntry, width, height int) string

RenderHelp renders a full-screen help overlay.

func RenderScrollbar

func RenderScrollbar(styles ui.Styles, height, totalLines, visibleH int, scrollPct float64) string

RenderScrollbar returns a vertical scrollbar track of the given height. It shows a thumb (filled block) proportional to the visible portion, positioned according to the scroll percentage.

Returns an empty string if all content fits (no scrolling needed).

Parameters:
  styles     – application styles (for theming)
  height     – total height of the scrollbar track (rows)
  totalLines – total number of content lines
  visibleH   – number of lines visible at once
  scrollPct  – current scroll position as 0.0–1.0

func RenderSideBySideDiff

func RenderSideBySideDiff(styles ui.Styles, diff string, totalWidth int) string

RenderSideBySideDiff renders a unified diff in side-by-side format with line numbers, gutter indicators, and clean styling.

func RenderStatusBar

func RenderStatusBar(styles ui.Styles, data StatusBarData, width int) string

RenderStatusBar renders the bottom status bar with clear visual sections separated by dim vertical bars.

Wide (>= 60): main │ ↑2 ↓1 │ ● modified zed-git-view Medium (40-59): main │ ↑2 ↓1 │ ● modified Narrow (< 40): main │ ● modified

func RenderTabs

func RenderTabs(styles ui.Styles, tabs []TabInfo, width int) string

RenderTabs renders a responsive tab bar that adapts to any width:

  • Wide: icon + full name, single row
  • Medium: icon + full name, wrapped to 2-3 rows
  • Narrow: icon + abbreviated name (3 chars)
  • Very narrow: icon only

Active tab has a bold accent underline beneath its row.

func TabBarRows

func TabBarRows(tabs []TabInfo, width int) int

TabBarRows returns the number of screen rows the tab bar will occupy (tab rows + 1 underline row).

Types

type Dialog

type Dialog struct {
	Kind    DialogKind
	Title   string
	Message string
	Tag     string
	// contains filtered or unexported fields
}

Dialog is a modal confirmation or input dialog.

func NewConfirmDialog

func NewConfirmDialog(styles ui.Styles, title, message, tag string) Dialog

NewConfirmDialog creates a Yes/No confirmation dialog.

func NewInputDialog

func NewInputDialog(styles ui.Styles, title, placeholder, tag string) Dialog

NewInputDialog creates a text input dialog.

func (Dialog) Update

func (d Dialog) Update(msg tea.Msg) (Dialog, tea.Cmd)

Update handles key events for the dialog.

func (Dialog) View

func (d Dialog) View() string

View renders the dialog.

func (Dialog) Visible

func (d Dialog) Visible() bool

Visible returns whether the dialog is showing.

type DialogKind

type DialogKind int

DialogKind specifies the type of dialog.

const (
	DialogConfirm DialogKind = iota
	DialogInput
)

type DialogResult

type DialogResult struct {
	Confirmed bool
	Value     string
	Tag       string // arbitrary tag to identify which dialog this was
}

DialogResult is sent when the dialog is dismissed.

type HelpEntry

type HelpEntry struct {
	Key  string
	Desc string
}

HelpEntry is a single key-description pair for the help overlay.

type StatusBarData

type StatusBarData struct {
	Branch   string
	Ahead    int
	Behind   int
	Clean    bool
	Merging  bool
	Rebasing bool
	Message  string // transient info/error message
	IsError  bool
	RepoRoot string
}

StatusBarData carries the info displayed in the bottom status bar.

type TabInfo

type TabInfo struct {
	Name     string
	Icon     string
	Shortcut string
	Active   bool
	Group    string
}

TabInfo describes a single tab for rendering.

Jump to

Keyboard shortcuts

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