feat(tui): codex-style input, history, bang commands, single-line status bar
- Arrow-key input history (up/down with multiline awareness) - Bang shell commands via ! prefix (requires --yolo) - Codex-style input bar with mode indicator (R/Y/⌘) - Command palette virtual scrolling - Multiline input viewport fix - Merged model pills + footer into single status line - Removed shift+enter (wait for TUI library support) - Removed default footer hints
This commit is contained in:
+59
-41
@@ -43,6 +43,7 @@ type theme struct {
|
||||
Background string
|
||||
Surface string
|
||||
SurfaceAlt string
|
||||
InputBg string
|
||||
Border string
|
||||
Text string
|
||||
Muted string
|
||||
@@ -56,35 +57,37 @@ type theme struct {
|
||||
}
|
||||
|
||||
type styles struct {
|
||||
App lipgloss.Style
|
||||
Muted lipgloss.Style
|
||||
Activity lipgloss.Style
|
||||
Header lipgloss.Style
|
||||
ModelMeta lipgloss.Style
|
||||
Footer lipgloss.Style
|
||||
Viewport lipgloss.Style
|
||||
InputBox lipgloss.Style
|
||||
CommandHint lipgloss.Style
|
||||
StatusReady lipgloss.Style
|
||||
StatusWarn lipgloss.Style
|
||||
StatusError lipgloss.Style
|
||||
StatusInfo lipgloss.Style
|
||||
Pill lipgloss.Style
|
||||
PillAccent lipgloss.Style
|
||||
Palette lipgloss.Style
|
||||
PaletteMatch lipgloss.Style
|
||||
ToolName lipgloss.Style
|
||||
ToolKey lipgloss.Style
|
||||
ToolValue lipgloss.Style
|
||||
UserLabel lipgloss.Style
|
||||
ToolLabel lipgloss.Style
|
||||
ErrorLabel lipgloss.Style
|
||||
SystemLabel lipgloss.Style
|
||||
UserMessage lipgloss.Style
|
||||
AssistantMsg lipgloss.Style
|
||||
ToolMessage lipgloss.Style
|
||||
ErrorMessage lipgloss.Style
|
||||
SystemMessage lipgloss.Style
|
||||
App lipgloss.Style
|
||||
Muted lipgloss.Style
|
||||
Activity lipgloss.Style
|
||||
Header lipgloss.Style
|
||||
Footer lipgloss.Style
|
||||
Viewport lipgloss.Style
|
||||
InputBox lipgloss.Style
|
||||
CommandHint lipgloss.Style
|
||||
InputModeReadonly lipgloss.Style
|
||||
InputModeYolo lipgloss.Style
|
||||
InputModeCommand lipgloss.Style
|
||||
StatusReady lipgloss.Style
|
||||
StatusWarn lipgloss.Style
|
||||
StatusError lipgloss.Style
|
||||
StatusInfo lipgloss.Style
|
||||
Pill lipgloss.Style
|
||||
PillAccent lipgloss.Style
|
||||
Palette lipgloss.Style
|
||||
PaletteMatch lipgloss.Style
|
||||
ToolName lipgloss.Style
|
||||
ToolKey lipgloss.Style
|
||||
ToolValue lipgloss.Style
|
||||
UserLabel lipgloss.Style
|
||||
ToolLabel lipgloss.Style
|
||||
ErrorLabel lipgloss.Style
|
||||
SystemLabel lipgloss.Style
|
||||
UserMessage lipgloss.Style
|
||||
AssistantMsg lipgloss.Style
|
||||
ToolMessage lipgloss.Style
|
||||
ErrorMessage lipgloss.Style
|
||||
SystemMessage lipgloss.Style
|
||||
}
|
||||
|
||||
func themeForMode(mode ThemeMode) theme {
|
||||
@@ -98,8 +101,8 @@ func lightTheme() theme {
|
||||
return theme{
|
||||
Mode: ThemeLight,
|
||||
Background: "#F8FAFC",
|
||||
Surface: "#FFFFFF",
|
||||
SurfaceAlt: "#EEF2F7",
|
||||
InputBg: "#E4E4E4",
|
||||
Border: "#CBD5E1",
|
||||
Text: "#111827",
|
||||
Muted: "#64748B",
|
||||
@@ -116,8 +119,8 @@ func darkTheme() theme {
|
||||
return theme{
|
||||
Mode: ThemeDark,
|
||||
Background: "#111827",
|
||||
Surface: "#1F2937",
|
||||
SurfaceAlt: "#0F172A",
|
||||
InputBg: "#383838",
|
||||
Border: "#475569",
|
||||
Text: "#E5E7EB",
|
||||
Muted: "#94A3B8",
|
||||
@@ -153,10 +156,6 @@ func (t theme) styles() styles {
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color(t.Title)),
|
||||
|
||||
ModelMeta: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Muted)).
|
||||
Padding(0, 1),
|
||||
|
||||
Footer: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Muted)).
|
||||
Padding(0, 1),
|
||||
@@ -166,14 +165,31 @@ func (t theme) styles() styles {
|
||||
|
||||
InputBox: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Text)).
|
||||
Border(lipgloss.ThickBorder()).
|
||||
BorderForeground(lipgloss.Color(t.Border)).
|
||||
Padding(0, 2),
|
||||
Background(lipgloss.Color(t.InputBg)).
|
||||
Padding(1, 2, 1, 1),
|
||||
|
||||
CommandHint: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Muted)).
|
||||
Padding(0, 1),
|
||||
|
||||
InputModeReadonly: lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color(t.Muted)).
|
||||
Background(lipgloss.Color(t.InputBg)).
|
||||
Padding(0, 1),
|
||||
|
||||
InputModeYolo: lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color(t.Error)).
|
||||
Background(lipgloss.Color(t.InputBg)).
|
||||
Padding(0, 1),
|
||||
|
||||
InputModeCommand: lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color(t.User)).
|
||||
Background(lipgloss.Color(t.InputBg)).
|
||||
Padding(0, 1),
|
||||
|
||||
StatusReady: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Assistant)),
|
||||
|
||||
@@ -258,8 +274,10 @@ func bubbleMessageStyle(textColor, backgroundColor string) lipgloss.Style {
|
||||
func applyTextareaTheme(input *textarea.Model, t theme) {
|
||||
focused := textarea.Style{
|
||||
Base: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Text)),
|
||||
CursorLine: lipgloss.NewStyle(),
|
||||
Foreground(lipgloss.Color(t.Text)).
|
||||
Background(lipgloss.Color(t.InputBg)),
|
||||
CursorLine: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color(t.InputBg)),
|
||||
Placeholder: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color(t.Muted)),
|
||||
Prompt: lipgloss.NewStyle().
|
||||
@@ -270,7 +288,7 @@ func applyTextareaTheme(input *textarea.Model, t theme) {
|
||||
Foreground(lipgloss.Color(t.Surface)),
|
||||
}
|
||||
blurred := focused
|
||||
blurred.CursorLine = lipgloss.NewStyle()
|
||||
blurred.CursorLine = lipgloss.NewStyle().Background(lipgloss.Color(t.InputBg))
|
||||
|
||||
input.FocusedStyle = focused
|
||||
input.BlurredStyle = blurred
|
||||
|
||||
Reference in New Issue
Block a user