layout

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanelStatus     = "status"      // top panel
	PanelLeft       = "left"        // left panel (unused currently)
	PanelMessages   = "messages"    // center panel
	PanelDebug      = "debug"       // right panel (debug component)
	PanelTextViewer = "text-viewer" // right panel (text viewer component)
	PanelDiffViewer = "diff-viewer" // right panel (diff viewer component)
	PanelInput      = "input"       // bottom panel
)

Panel name constants - using semantic names

Variables

This section is empty.

Functions

This section is empty.

Types

type LayoutConfig

type LayoutConfig struct {
	MessagesWeight int  // Weight for messages panel
	InputHeight    int  // Fixed height for input panel
	DebugWeight    int  // Weight for debug panel when visible
	StatusHeight   int  // Fixed height for status panel
	ShowSidebar    bool // Legacy field - kept for compatibility
	CompactMode    bool // Compact mode toggle
	MinPanelWidth  int  // Minimum panel width
	MinPanelHeight int  // Minimum panel height
}

func NewDefaultLayoutConfig

func NewDefaultLayoutConfig(config *types.Config) *LayoutConfig

type LayoutManager

type LayoutManager struct {
	// contains filtered or unexported fields
}

func NewLayoutManager

func NewLayoutManager(gui *gocui.Gui, config *LayoutConfig) *LayoutManager

func (*LayoutManager) AddSubPanel

func (lm *LayoutManager) AddSubPanel(parentPanelName, subPanelName string, component types.Component)

AddSubPanel adds a sub-panel to a composite component (like status bar)

func (*LayoutManager) DisableAllKeybindings

func (lm *LayoutManager) DisableAllKeybindings()

DisableAllKeybindings removes all keybindings from all panels

func (*LayoutManager) EnableAllKeybindings

func (lm *LayoutManager) EnableAllKeybindings() error

EnableAllKeybindings restores keybindings for all panels

func (*LayoutManager) FocusNextPanel

func (lm *LayoutManager) FocusNextPanel() string

FocusNextPanel focuses the next panel in navigation order and returns the focused panel name

func (*LayoutManager) FocusPanel

func (lm *LayoutManager) FocusPanel(panelName string) error

FocusPanel focuses the specified panel by name, handling focus transitions

func (*LayoutManager) GetAvailablePanels

func (lm *LayoutManager) GetAvailablePanels() []string

GetAvailablePanels returns panel names that have components assigned

func (*LayoutManager) GetComponent

func (lm *LayoutManager) GetComponent(panelName string) types.Component

func (*LayoutManager) GetConfig

func (lm *LayoutManager) GetConfig() *LayoutConfig

func (*LayoutManager) GetLastSize

func (lm *LayoutManager) GetLastSize() (int, int)

GetLastSize returns the last known terminal size

func (*LayoutManager) GetPanel

func (lm *LayoutManager) GetPanel(panelName string) *Panel

func (*LayoutManager) GetRightPanelMode

func (lm *LayoutManager) GetRightPanelMode() string

GetRightPanelMode returns the current right panel mode

func (*LayoutManager) HideRightPanel

func (lm *LayoutManager) HideRightPanel()

HideRightPanel hides all right panel components

func (*LayoutManager) IsRightPanelVisible

func (lm *LayoutManager) IsRightPanelVisible() bool

IsRightPanelVisible returns whether the right panel is visible

func (*LayoutManager) IsRightPanelZoomed added in v0.1.4

func (lm *LayoutManager) IsRightPanelZoomed() bool

IsRightPanelZoomed returns whether the right panel is currently zoomed

func (*LayoutManager) Layout

func (lm *LayoutManager) Layout(g *gocui.Gui) error

func (*LayoutManager) ResetKeybindings

func (lm *LayoutManager) ResetKeybindings() error

ResetKeybindings resets keybindings for all panels This ensures that component keybindings are properly registered after swaps

func (*LayoutManager) SetComponent

func (lm *LayoutManager) SetComponent(panelName string, component types.Component)

func (*LayoutManager) SetConfig

func (lm *LayoutManager) SetConfig(config *LayoutConfig)

func (*LayoutManager) SetFocus

func (lm *LayoutManager) SetFocus(panelName string)

func (*LayoutManager) ShowRightPanel

func (lm *LayoutManager) ShowRightPanel(mode string)

ShowRightPanel shows the specified right panel mode

func (*LayoutManager) SwapComponent

func (lm *LayoutManager) SwapComponent(panelName string, newComponent types.Component) error

SwapComponent replaces a panel's component with a new one (for confirmations)

func (*LayoutManager) SwitchRightPanelMode

func (lm *LayoutManager) SwitchRightPanelMode(mode string)

SwitchRightPanelMode switches the right panel mode

func (*LayoutManager) ToggleRightPanel

func (lm *LayoutManager) ToggleRightPanel()

ToggleRightPanel toggles the right panel visibility

func (*LayoutManager) ToggleRightPanelZoom added in v0.1.4

func (lm *LayoutManager) ToggleRightPanelZoom()

ToggleRightPanelZoom toggles the right panel zoom state

func (*LayoutManager) UnzoomRightPanel added in v0.1.4

func (lm *LayoutManager) UnzoomRightPanel()

UnzoomRightPanel returns the right panel to normal size

func (*LayoutManager) ZoomRightPanel added in v0.1.4

func (lm *LayoutManager) ZoomRightPanel()

ZoomRightPanel zooms the right panel to take most of the layout space

type Panel

type Panel struct {
	Name       string
	Component  types.Component
	Dimensions boxlayout.Dimensions
	View       *gocui.View
	Visible    bool

	// For composite components like status bar
	SubPanels map[string]*Panel
	// contains filtered or unexported fields
}

Panel represents a single layout area that contains a component and its view

func NewPanel

func NewPanel(name string, component types.Component, gui *gocui.Gui) *Panel

NewPanel creates a new panel with the given component

func (*Panel) AddSubPanel

func (p *Panel) AddSubPanel(name string, component types.Component)

AddSubPanel adds a sub-panel for composite components

func (*Panel) CreateOrUpdateView

func (p *Panel) CreateOrUpdateView() error

CreateOrUpdateView creates or updates the gocui view for this panel

func (*Panel) GetSubPanel

func (p *Panel) GetSubPanel(name string) *Panel

GetSubPanel returns a sub-panel by name

func (*Panel) IsVisible

func (p *Panel) IsVisible() bool

IsVisible returns whether the panel is visible

func (*Panel) Render

func (p *Panel) Render() error

Render renders the panel's component if visible

func (*Panel) SetVisible

func (p *Panel) SetVisible(visible bool)

SetVisible sets the panel's visibility

func (*Panel) SwapComponent

func (p *Panel) SwapComponent(newComponent types.Component) error

SwapComponent replaces the panel's component with a new one

func (*Panel) UpdateDimensions

func (p *Panel) UpdateDimensions(dims boxlayout.Dimensions) error

UpdateDimensions updates the panel's dimensions and propagates to the view

Jump to

Keyboard shortcuts

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