component

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUnboundSpecialKey added in v0.1.6

func IsUnboundSpecialKey(key gocui.Key) bool

IsUnboundSpecialKey checks if a key is a special key that should be ignored.

func NewCustomEditor

func NewCustomEditor() gocui.Editor

NewCustomEditor creates a new instance of CustomEditor.

func NewViEditor

func NewViEditor() gocui.Editor

NewViEditor creates a new instance of ViEditor.

Types

type BaseComponent

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

func NewBaseComponent

func NewBaseComponent(key, viewName string, gui types.Gui, configManager *helpers.ConfigManager) *BaseComponent

func (*BaseComponent) GetConfig

func (c *BaseComponent) GetConfig() *types.Config

GetConfig returns the current config from ConfigManager

func (*BaseComponent) GetKey

func (c *BaseComponent) GetKey() string

func (*BaseComponent) GetKeybindings

func (c *BaseComponent) GetKeybindings() []*types.KeyBinding

func (*BaseComponent) GetTheme

func (c *BaseComponent) GetTheme() *types.Theme

GetTheme returns the current theme from ConfigManager

func (*BaseComponent) GetTitle

func (c *BaseComponent) GetTitle() string

func (*BaseComponent) GetView

func (c *BaseComponent) GetView() *gocui.View

func (*BaseComponent) GetViewName

func (c *BaseComponent) GetViewName() string

func (*BaseComponent) GetWindowProperties

func (c *BaseComponent) GetWindowProperties() types.WindowProperties

func (*BaseComponent) HandleFocus

func (c *BaseComponent) HandleFocus() error

func (*BaseComponent) HandleFocusLost

func (c *BaseComponent) HandleFocusLost() error

func (*BaseComponent) HasControlledBounds

func (c *BaseComponent) HasControlledBounds() bool

func (*BaseComponent) RefreshThemeColors

func (c *BaseComponent) RefreshThemeColors()

RefreshThemeColors updates border colors based on current theme

func (*BaseComponent) Render

func (c *BaseComponent) Render() error

func (*BaseComponent) SetControlledBounds

func (c *BaseComponent) SetControlledBounds(controlled bool)

func (*BaseComponent) SetOnFocus

func (c *BaseComponent) SetOnFocus(fn func() error)

func (*BaseComponent) SetOnFocusLost

func (c *BaseComponent) SetOnFocusLost(fn func() error)

func (*BaseComponent) SetTitle

func (c *BaseComponent) SetTitle(title string)

func (*BaseComponent) SetView

func (c *BaseComponent) SetView(v *gocui.View)

func (*BaseComponent) SetWindowName

func (c *BaseComponent) SetWindowName(windowName string)

func (*BaseComponent) SetWindowProperties

func (c *BaseComponent) SetWindowProperties(props types.WindowProperties)

type ConfirmationComponent

type ConfirmationComponent struct {
	*BaseComponent

	// Confirmation state
	ExecutionID string // Public so it can be updated
	// contains filtered or unexported fields
}

func NewConfirmationComponent

func NewConfirmationComponent(gui types.Gui, configManager *helpers.ConfigManager, executionID, message string, onConfirmation func(string, bool) error) *ConfirmationComponent

func (*ConfirmationComponent) GetKeybindings

func (c *ConfirmationComponent) GetKeybindings() []*types.KeyBinding

func (*ConfirmationComponent) HandleFocus

func (c *ConfirmationComponent) HandleFocus() error

HandleFocus overrides BaseComponent to use secondary color

func (*ConfirmationComponent) HandleFocusLost

func (c *ConfirmationComponent) HandleFocusLost() error

HandleFocusLost overrides BaseComponent to use secondary color

func (*ConfirmationComponent) RefreshThemeColors

func (c *ConfirmationComponent) RefreshThemeColors()

RefreshThemeColors updates the border color to use current secondary theme color

type ConfirmationDialogComponent

type ConfirmationDialogComponent struct {
	*DialogComponent
	// contains filtered or unexported fields
}

ConfirmationDialogComponent provides a dialog for confirming tool execution with optional content preview (like file diffs, command details, etc.)

func NewConfirmationDialogComponent

func NewConfirmationDialogComponent(
	title, message, content, contentType string,
	confirmText, cancelText string,
	guiCommon types.Gui,
	configManager *helpers.ConfigManager,
	onConfirm, onCancel func() error,
	onClose func() error,
) *ConfirmationDialogComponent

func (*ConfirmationDialogComponent) Close

Close restores cursor and closes the dialog

func (*ConfirmationDialogComponent) GetKeybindings

func (c *ConfirmationDialogComponent) GetKeybindings() []*types.KeyBinding

func (*ConfirmationDialogComponent) Render

func (c *ConfirmationDialogComponent) Render() error

func (*ConfirmationDialogComponent) Show

Show displays the confirmation dialog with appropriate size based on content

type ContextViewport

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

ContextViewport handles scrolling within the content panel

type CustomEditor

type CustomEditor struct{}

CustomEditor implements the gocui.Editor interface to provide extended navigation.

func (*CustomEditor) Edit

func (e *CustomEditor) Edit(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier)

Edit handles the editor's behavior for input.

type DebugComponent

type DebugComponent struct {
	*BaseComponent
	*ScrollableBase
	// contains filtered or unexported fields
}

func NewDebugComponent

func NewDebugComponent(gui types.Gui, debugState *state.DebugState, configManager *helpers.ConfigManager, eventBus *events.CommandEventBus) *DebugComponent

func (*DebugComponent) GetKeybindings

func (c *DebugComponent) GetKeybindings() []*types.KeyBinding

func (*DebugComponent) IsVisible

func (c *DebugComponent) IsVisible() bool

func (*DebugComponent) OnMessageAdded

func (c *DebugComponent) OnMessageAdded() error

OnMessageAdded should be called when a new debug message is added to state

func (*DebugComponent) Render

func (c *DebugComponent) Render() error

func (*DebugComponent) SetVisible

func (c *DebugComponent) SetVisible(visible bool)

func (*DebugComponent) ToggleVisibility

func (c *DebugComponent) ToggleVisibility()

type DialogBounds

type DialogBounds struct {
	X      int
	Y      int
	Width  int
	Height int
}

DialogBounds represents the position and size of a dialog

type DialogComponent

type DialogComponent struct {
	*BaseComponent
	// contains filtered or unexported fields
}

DialogComponent provides base functionality for dialog overlays

func NewDialogComponent

func NewDialogComponent(key, viewName string, guiCommon types.Gui, configManager *helpers.ConfigManager, onClose func() error) *DialogComponent

NewDialogComponent creates a new dialog base component

func (*DialogComponent) CalculateDialogBounds

func (d *DialogComponent) CalculateDialogBounds(widthPercent, heightPercent int, minWidth, minHeight, maxWidth, maxHeight int) DialogBounds

CalculateDialogBounds calculates centered dialog position and size

func (*DialogComponent) Close

func (d *DialogComponent) Close() error

Close calls the onClose callback if set

func (*DialogComponent) GetCloseKeybindings

func (d *DialogComponent) GetCloseKeybindings() []*types.KeyBinding

Common dialog keybinding for closing

func (*DialogComponent) GetInternalView

func (d *DialogComponent) GetInternalView(windowName string) *gocui.View

GetInternalView returns a view by window name

func (*DialogComponent) Hide

func (d *DialogComponent) Hide() error

Hide closes the dialog and cleans up views

func (*DialogComponent) IsVisible

func (d *DialogComponent) IsVisible() bool

IsVisible returns whether the dialog is currently shown

func (*DialogComponent) LayoutDialog

func (d *DialogComponent) LayoutDialog() error

LayoutDialog arranges internal views using boxlayout

func (*DialogComponent) SetInternalLayout

func (d *DialogComponent) SetInternalLayout(layout *boxlayout.Box)

SetInternalLayout sets the boxlayout structure for the dialog

func (*DialogComponent) Show

func (d *DialogComponent) Show(bounds DialogBounds) error

Show displays the dialog

type DiffViewerComponent

type DiffViewerComponent struct {
	*BaseComponent
	*ScrollableBase
	// contains filtered or unexported fields
}

func NewDiffViewerComponent

func NewDiffViewerComponent(gui types.Gui, title string, configManager *helpers.ConfigManager, eventBus *events.CommandEventBus) *DiffViewerComponent

func (*DiffViewerComponent) FormatDiff

func (c *DiffViewerComponent) FormatDiff(content string) string

FormatDiff applies diff theme colors to diff content

func (*DiffViewerComponent) GetContent

func (c *DiffViewerComponent) GetContent() string

GetContent returns the current diff content

func (*DiffViewerComponent) GetKeybindings

func (c *DiffViewerComponent) GetKeybindings() []*types.KeyBinding

func (*DiffViewerComponent) IsVisible

func (c *DiffViewerComponent) IsVisible() bool

func (*DiffViewerComponent) Render

func (c *DiffViewerComponent) Render() error

func (*DiffViewerComponent) SetContent

func (c *DiffViewerComponent) SetContent(content string)

SetContent updates the diff content to display

func (*DiffViewerComponent) SetTitle

func (c *DiffViewerComponent) SetTitle(title string)

SetTitle updates the component title

func (*DiffViewerComponent) SetVisible

func (c *DiffViewerComponent) SetVisible(visible bool)

func (*DiffViewerComponent) ToggleVisibility

func (c *DiffViewerComponent) ToggleVisibility()

type InputComponent

type InputComponent struct {
	*BaseComponent
	// contains filtered or unexported fields
}

func NewInputComponent

func NewInputComponent(gui types.Gui, configManager *helpers.ConfigManager, commandEventBus *events.CommandEventBus, clipboard *helpers.Clipboard, historyPath string, commandSuggester *shell.CommandSuggester, slashCommandSuggester *shell.SlashCommandSuggester) *InputComponent

func (*InputComponent) GetKeybindings

func (c *InputComponent) GetKeybindings() []*types.KeyBinding

func (*InputComponent) LoadHistory

func (c *InputComponent) LoadHistory() error

func (*InputComponent) RegisterSuggester added in v0.1.6

func (c *InputComponent) RegisterSuggester(suggester shell.Suggester)

RegisterSuggester adds a suggester to the input component's completer

func (*InputComponent) SetView added in v0.1.4

func (c *InputComponent) SetView(view *gocui.View)

type LLMContextViewerComponent

type LLMContextViewerComponent struct {
	*BaseComponent
	// contains filtered or unexported fields
}

LLMContextViewerComponent provides a full-screen modal for viewing LLM context data. It displays context parts organized by provider with dual-panel navigation similar to the previous TUI implementation.

func NewLLMContextViewerComponent

func NewLLMContextViewerComponent(guiCommon types.Gui, configManager *helpers.ConfigManager, dataProvider types.LLMContextDataProvider, onClose func() error) *LLMContextViewerComponent

func (*LLMContextViewerComponent) Close

func (c *LLMContextViewerComponent) Close() error

Close restores the cursor and closes the context viewer

func (*LLMContextViewerComponent) GetInternalView

func (c *LLMContextViewerComponent) GetInternalView(windowName string) *gocui.View

GetInternalView returns a view by window name

func (*LLMContextViewerComponent) GetKeybindings

func (c *LLMContextViewerComponent) GetKeybindings() []*types.KeyBinding

func (*LLMContextViewerComponent) IsVisible

func (c *LLMContextViewerComponent) IsVisible() bool

IsVisible returns whether the context viewer is currently visible

func (*LLMContextViewerComponent) Layout

func (c *LLMContextViewerComponent) Layout() error

Layout creates the full-screen layout for the context viewer

func (*LLMContextViewerComponent) LoadContextData

func (c *LLMContextViewerComponent) LoadContextData() error

LoadContextData fetches context data from the controller

func (*LLMContextViewerComponent) Render

func (c *LLMContextViewerComponent) Render() error

func (*LLMContextViewerComponent) SelectContextKey

func (c *LLMContextViewerComponent) SelectContextKey(keyName string)

SelectContextKey allows external code to jump to a specific context key

func (*LLMContextViewerComponent) Show

func (c *LLMContextViewerComponent) Show() error

Show displays the context viewer in full-screen mode

type MessagesComponent

type MessagesComponent struct {
	*BaseComponent
	*ScrollableBase
	// contains filtered or unexported fields
}

func NewMessagesComponent

func NewMessagesComponent(gui types.Gui, state *state.ChatState, configManager *helpers.ConfigManager, eventBus *events.CommandEventBus) *MessagesComponent

func (*MessagesComponent) GetKeybindings

func (c *MessagesComponent) GetKeybindings() []*types.KeyBinding

func (*MessagesComponent) RefreshBorderSettings

func (c *MessagesComponent) RefreshBorderSettings()

RefreshBorderSettings updates the border visibility based on current config

func (*MessagesComponent) Render

func (c *MessagesComponent) Render() error

type Scrollable

type Scrollable interface {
	ScrollUp() error
	ScrollDown() error
	PageUp() error
	PageDown() error
	ScrollToTop() error
	ScrollToBottom() error
}

Scrollable defines the interface for components that support scrolling

type ScrollableBase

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

ScrollableBase provides default scroll implementations for components

func NewScrollableBase

func NewScrollableBase(viewGetter func() *gocui.View) *ScrollableBase

NewScrollableBase creates a new ScrollableBase with a view getter function

func (*ScrollableBase) PageDown

func (s *ScrollableBase) PageDown() error

PageDown scrolls the view down by one page

func (*ScrollableBase) PageUp

func (s *ScrollableBase) PageUp() error

PageUp scrolls the view up by one page

func (*ScrollableBase) ScrollDown

func (s *ScrollableBase) ScrollDown() error

ScrollDown scrolls the view down by one line

func (*ScrollableBase) ScrollToBottom

func (s *ScrollableBase) ScrollToBottom() error

ScrollToBottom scrolls the view to the bottom using the view's buffer

func (*ScrollableBase) ScrollToTop

func (s *ScrollableBase) ScrollToTop() error

ScrollToTop scrolls the view to the top

func (*ScrollableBase) ScrollUp

func (s *ScrollableBase) ScrollUp() error

ScrollUp scrolls the view up by one line

type StatusComponent

type StatusComponent struct {
	*BaseComponent
	// contains filtered or unexported fields
}

func NewStatusComponent

func NewStatusComponent(gui types.Gui, state types.IStateAccessor, configManager *helpers.ConfigManager, eventBus *events.CommandEventBus) *StatusComponent

func (*StatusComponent) Close

func (c *StatusComponent) Close()

Close stops any running status updates and cleans up resources

func (*StatusComponent) GetCenterComponent

func (c *StatusComponent) GetCenterComponent() types.Component

GetCenterComponent returns the center section component

func (*StatusComponent) GetLeftComponent

func (c *StatusComponent) GetLeftComponent() types.Component

GetLeftComponent returns the left section component

func (*StatusComponent) GetRightComponent

func (c *StatusComponent) GetRightComponent() types.Component

GetRightComponent returns the right section component

func (*StatusComponent) Render

func (c *StatusComponent) Render() error

func (*StatusComponent) SetCenterText

func (c *StatusComponent) SetCenterText(text string)

SetCenterText sets the text to display in the center of the status bar

func (*StatusComponent) SetLeftText

func (c *StatusComponent) SetLeftText(text string)

SetLeftText sets the text to display on the left side of the status bar

func (*StatusComponent) SetLeftToReady

func (c *StatusComponent) SetLeftToReady()

SetLeftToReady sets the left text to the ready indicator (colored circle)

func (*StatusComponent) SetRightText

func (c *StatusComponent) SetRightText(text string)

SetRightText sets the text to display on the right side of the status bar

func (*StatusComponent) SetStatusTexts

func (c *StatusComponent) SetStatusTexts(left, center, right string)

SetStatusTexts sets all three text sections at once

type StatusSectionComponent

type StatusSectionComponent struct {
	*BaseComponent
	// contains filtered or unexported fields
}

func NewStatusSectionComponent

func NewStatusSectionComponent(name, viewName string, gui types.Gui, configManager *helpers.ConfigManager) *StatusSectionComponent

func (*StatusSectionComponent) GetText

func (c *StatusSectionComponent) GetText() string

func (*StatusSectionComponent) Render

func (c *StatusSectionComponent) Render() error

func (*StatusSectionComponent) SetText

func (c *StatusSectionComponent) SetText(text string)

type TextViewerComponent

type TextViewerComponent struct {
	*BaseComponent
	*ScrollableBase
	// contains filtered or unexported fields
}

func NewTextViewerComponent

func NewTextViewerComponent(gui types.Gui, title string, configManager *helpers.ConfigManager, eventBus *events.CommandEventBus) *TextViewerComponent

func (*TextViewerComponent) GetContent

func (c *TextViewerComponent) GetContent() string

GetContent returns the current text content

func (*TextViewerComponent) GetContentType

func (c *TextViewerComponent) GetContentType() string

GetContentType returns the content type

func (*TextViewerComponent) GetKeybindings

func (c *TextViewerComponent) GetKeybindings() []*types.KeyBinding

func (*TextViewerComponent) IsVisible

func (c *TextViewerComponent) IsVisible() bool

func (*TextViewerComponent) ProcessMarkdown

func (c *TextViewerComponent) ProcessMarkdown(content string) string

ProcessMarkdown renders markdown using glamour like the message formatter

func (*TextViewerComponent) Render

func (c *TextViewerComponent) Render() error

func (*TextViewerComponent) SetContent

func (c *TextViewerComponent) SetContent(content string)

SetContent updates the text content to display

func (*TextViewerComponent) SetContentWithType

func (c *TextViewerComponent) SetContentWithType(content, contentType string)

SetContentWithType updates the text content and content type

func (*TextViewerComponent) SetTitle

func (c *TextViewerComponent) SetTitle(title string)

SetTitle updates the component title

func (*TextViewerComponent) SetVisible

func (c *TextViewerComponent) SetVisible(visible bool)

func (*TextViewerComponent) ToggleVisibility

func (c *TextViewerComponent) ToggleVisibility()

type ViEditor

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

ViEditor implements the gocui.Editor interface to provide vi-like editing.

func (*ViEditor) Edit

func (e *ViEditor) Edit(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier)

Edit handles the editor's behavior for input based on the current vi mode.

func (*ViEditor) GetCommandBuffer

func (e *ViEditor) GetCommandBuffer() string

GetCommandBuffer returns the current command buffer (for displaying command line)

func (*ViEditor) GetMode

func (e *ViEditor) GetMode() ViMode

GetMode returns the current vim mode

func (*ViEditor) SetCommandHandler

func (e *ViEditor) SetCommandHandler(handler func(string) error)

SetCommandHandler sets the callback function for handling vim commands

func (*ViEditor) SetModeChangeHandler

func (e *ViEditor) SetModeChangeHandler(handler func())

SetModeChangeHandler sets the callback function for mode changes

type ViMode

type ViMode int

ViMode represents the current mode of the Vi editor.

const (
	NormalMode ViMode = iota
	InsertMode
	CommandMode
)

type WriteComponent

type WriteComponent struct {
	*BaseComponent
	// contains filtered or unexported fields
}

WriteComponent provides a full-screen text area for composing longer messages

func NewWriteComponent

func NewWriteComponent(
	gui types.Gui,
	configManager *helpers.ConfigManager,
	commandEventBus *events.CommandEventBus,
	onClose func() error,
) *WriteComponent

func (*WriteComponent) CreateView

func (c *WriteComponent) CreateView() (*gocui.View, error)

SetInitialContent sets the initial content for the text area CreateView creates a full-screen overlay view for the text area

func (*WriteComponent) GetKeybindings

func (c *WriteComponent) GetKeybindings() []*types.KeyBinding

func (*WriteComponent) LoadHistory

func (c *WriteComponent) LoadHistory() error

func (*WriteComponent) RefreshEditor

func (c *WriteComponent) RefreshEditor()

RefreshEditor updates the editor when vim mode changes

func (*WriteComponent) RefreshKeybindings

func (c *WriteComponent) RefreshKeybindings()

RefreshKeybindings updates the keybindings when configuration changes

func (*WriteComponent) SetInitialContent

func (c *WriteComponent) SetInitialContent(content string)

func (*WriteComponent) Show

func (c *WriteComponent) Show() error

Show displays the write input overlay

Jump to

Keyboard shortcuts

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