Documentation
¶
Overview ¶
Package cmdbar is the command/status bar TUI component.
Index ¶
- Variables
- func ApplyTheme(t CmdBarTheme)
- func ParseCommand(input string) (string, []string)
- type ArgCompleter
- type CmdBarTheme
- type CommandMsg
- type Level
- type Model
- func (c *Model) Activate()
- func (c *Model) ClearStatus()
- func (c *Model) Reset()
- func (c *Model) SetError(s string)
- func (c *Model) SetStatus(s string)
- func (c *Model) SetSuccess(s string)
- func (c *Model) SetWarn(s string)
- func (c Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (c Model) View() string
Constants ¶
This section is empty.
Variables ¶
var ( CmdBarStyle = lipgloss.NewStyle(). Border(lipgloss.NormalBorder(), true, false, false, false). BorderForeground(lipgloss.Color("240")). Padding(0, 1) ModeViewStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("252")). Background(lipgloss.Color("62")) ModeNormalStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("252")). Background(lipgloss.Color("157")) ModeInsertStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("252")). Background(lipgloss.Color("212")) ModeReplaceStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("252")). Background(lipgloss.Color("203")) ModeVisualStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("252")). Background(lipgloss.Color("214")) )
Command bar lipgloss styles, updated by ApplyTheme.
Functions ¶
func ApplyTheme ¶
func ApplyTheme(t CmdBarTheme)
ApplyTheme updates the mode indicator styles from theme colors.
func ParseCommand ¶
ParseCommand parses a command string into a command name and arguments. The special prefix "/" is treated as a vim-style in-buffer search: the entire string after the slash becomes a single argument (no quote stripping, no space splitting) so that patterns like "/hello world" work correctly.
Types ¶
type ArgCompleter ¶
ArgCompleter returns completion candidates for a command argument. cmd is the command name; argPrefix is the partial argument typed so far.
type CmdBarTheme ¶
type CmdBarTheme struct {
ModeView lipgloss.Color
ModeNormal lipgloss.Color
ModeInsert lipgloss.Color
ModeReplace lipgloss.Color
ModeVisual lipgloss.Color
Accent lipgloss.Color
TabBg lipgloss.Color
Dim lipgloss.Color
}
CmdBarTheme holds the colors needed to style the command bar.
type CommandMsg ¶
CommandMsg is dispatched when the user submits a command.
type Model ¶
type Model struct {
Input textinput.Model
Status string
StatusLevel Level
Active bool
Width int
// Mode indicator (set by app from viewer)
ModeLabel common.Mode
ModeLine int
ModeCol int
ArgComplete ArgCompleter
// contains filtered or unexported fields
}
Model is the command bar component.
func New ¶
func New(custom *theme.CustomTheme, keys config.Keys) Model
New creates a new command bar model.
func (*Model) ClearStatus ¶
func (c *Model) ClearStatus()
ClearStatus clears the status message and resets the level.
func (*Model) Reset ¶
func (c *Model) Reset()
Reset clears the command bar and returns it to the default hint.
func (*Model) SetSuccess ¶
SetSuccess sets a success status message.