summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/components
diff options
context:
space:
mode:
authoradamdotdevin <[email protected]>2025-08-13 13:28:22 -0500
committeradamdotdevin <[email protected]>2025-08-13 13:28:22 -0500
commit1357319f6f01532a3544a23d9282f9583a422608 (patch)
tree1336779e02fea755bc45c8fc6d8f6db6ccbb9ccc /packages/tui/internal/components
parente729eed34d54758d4630012bf2396c064a71522e (diff)
downloadopencode-1357319f6f01532a3544a23d9282f9583a422608.tar.gz
opencode-1357319f6f01532a3544a23d9282f9583a422608.zip
feat: bash commands
Diffstat (limited to 'packages/tui/internal/components')
-rw-r--r--packages/tui/internal/components/chat/editor.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index 980d5262c..a51f158ce 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -39,6 +39,7 @@ type EditorComponent interface {
Focus() (tea.Model, tea.Cmd)
Blur()
Submit() (tea.Model, tea.Cmd)
+ SubmitBash() (tea.Model, tea.Cmd)
Clear() (tea.Model, tea.Cmd)
Paste() (tea.Model, tea.Cmd)
Newline() (tea.Model, tea.Cmd)
@@ -342,6 +343,14 @@ func (m *editorComponent) Content() string {
Padding(0, 0, 0, 1).
Bold(true)
prompt := promptStyle.Render(">")
+ borderForeground := t.Border()
+ if m.app.IsLeaderSequence {
+ borderForeground = t.Accent()
+ }
+ if m.app.IsBashMode {
+ borderForeground = t.Secondary()
+ prompt = promptStyle.Render("!")
+ }
m.textarea.SetWidth(width - 6)
textarea := lipgloss.JoinHorizontal(
@@ -349,10 +358,6 @@ func (m *editorComponent) Content() string {
prompt,
m.textarea.View(),
)
- borderForeground := t.Border()
- if m.app.IsLeaderSequence {
- borderForeground = t.Accent()
- }
textarea = styles.NewStyle().
Background(t.BackgroundElement()).
Width(width).
@@ -489,6 +494,16 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
return m, tea.Batch(cmds...)
}
+func (m *editorComponent) SubmitBash() (tea.Model, tea.Cmd) {
+ command := m.textarea.Value()
+ var cmds []tea.Cmd
+ updated, cmd := m.Clear()
+ m = updated.(*editorComponent)
+ cmds = append(cmds, cmd)
+ cmds = append(cmds, util.CmdHandler(app.SendBash{Command: command}))
+ return m, tea.Batch(cmds...)
+}
+
func (m *editorComponent) Clear() (tea.Model, tea.Cmd) {
m.textarea.Reset()
m.historyIndex = -1