focus

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package focus provides focus state management and geometric navigation for panes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BorderManager

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

BorderManager manages mode indicator borders on the workspace container. It creates a transparent overlay box that displays colored borders when the user enters tab mode or pane mode.

func NewBorderManager

func NewBorderManager(factory layout.WidgetFactory) *BorderManager

NewBorderManager creates a border manager. It creates a border overlay widget that should be added to the workspace container.

func (*BorderManager) CurrentMode

func (bm *BorderManager) CurrentMode() input.Mode

CurrentMode returns the current input mode.

func (*BorderManager) OnModeChange

func (bm *BorderManager) OnModeChange(ctx context.Context, from, to input.Mode)

OnModeChange updates border visibility based on mode.

func (*BorderManager) Widget

func (bm *BorderManager) Widget() layout.Widget

Widget returns the border overlay widget for adding to workspace overlay.

type Manager

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

Manager handles focus state and geometric navigation.

func NewManager

func NewManager(panesUC *usecase.ManagePanesUseCase) *Manager

NewManager creates a focus manager.

func (*Manager) CollectPaneRects

func (m *Manager) CollectPaneRects(ctx context.Context, provider PaneGeometryProvider) []entity.PaneRect

CollectPaneRects gathers geometry from all visible panes. For panes in stacks, uses the stack container's geometry since individual collapsed panes have no allocated size. Only visible panes are included - for stacked panes, only the active one is visible.

func (*Manager) NavigateGeometric

func (m *Manager) NavigateGeometric(
	ctx context.Context,
	ws *entity.Workspace,
	provider PaneGeometryProvider,
	direction usecase.NavigateDirection,
) (*entity.PaneNode, error)

NavigateGeometric performs geometric navigation and returns the target pane. It handles stack navigation internally: when navigating up/down and the current pane is in a stack, it will try to navigate within the stack first before escaping to external panes.

type PaneGeometryProvider

type PaneGeometryProvider interface {
	// GetPaneIDs returns all pane IDs in the provider.
	GetPaneIDs() []entity.PaneID
	// GetPaneWidget returns the widget for a pane, or nil if not found.
	GetPaneWidget(paneID entity.PaneID) layout.Widget
	// GetStackContainerWidget returns the stack container widget for a stacked pane.
	// Returns nil if the pane is not in a stack.
	GetStackContainerWidget(paneID entity.PaneID) layout.Widget
	// ContainerWidget returns the container widget for relative positioning.
	ContainerWidget() layout.Widget
}

PaneGeometryProvider provides geometry information for panes. This interface allows the focus manager to work without direct component dependencies.

Jump to

Keyboard shortcuts

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