summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/components
diff options
context:
space:
mode:
authoradamdotdevin <[email protected]>2025-07-16 14:20:19 -0500
committeradamdotdevin <[email protected]>2025-07-16 14:20:28 -0500
commitf7dd48e60dbe0fe05ddd8720af2dba619eae5b0f (patch)
tree267ddf2bf64718346fa47d6c430eb8331a5e50b0 /packages/tui/internal/components
parent93c779cf4832ce2166ae1012047015fec19ae2c0 (diff)
downloadopencode-f7dd48e60dbe0fe05ddd8720af2dba619eae5b0f.tar.gz
opencode-f7dd48e60dbe0fe05ddd8720af2dba619eae5b0f.zip
feat(tui): more ways to quit
Diffstat (limited to 'packages/tui/internal/components')
-rw-r--r--packages/tui/internal/components/chat/editor.go6
-rw-r--r--packages/tui/internal/components/dialog/complete.go5
2 files changed, 7 insertions, 4 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index de74b4895..efbc08349 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -344,6 +344,12 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
if value == "" {
return m, nil
}
+
+ switch value {
+ case "exit", "quit", "q", ":q":
+ return m, tea.Quit
+ }
+
if len(value) > 0 && value[len(value)-1] == '\\' {
// If the last character is a backslash, remove it and add a newline
m.textarea.ReplaceRange(len(value)-1, len(value), "")
diff --git a/packages/tui/internal/components/dialog/complete.go b/packages/tui/internal/components/dialog/complete.go
index 52501c894..ef02c0a84 100644
--- a/packages/tui/internal/components/dialog/complete.go
+++ b/packages/tui/internal/components/dialog/complete.go
@@ -85,7 +85,7 @@ func (c *completionDialogComponent) getAllCompletions(query string) tea.Cmd {
}
// If there's a query, use fuzzy ranking to sort results
- if query != "" && len(allItems) > 0 {
+ if query != "" && len(allItems) > 0 && len(c.providers) > 1 {
t := theme.CurrentTheme()
baseStyle := styles.NewStyle().Background(t.BackgroundElement())
// Create a slice of display values for fuzzy matching
@@ -94,10 +94,7 @@ func (c *completionDialogComponent) getAllCompletions(query string) tea.Cmd {
displayValues[i] = item.Display(baseStyle)
}
- // Get fuzzy matches with ranking
matches := fuzzy.RankFindFold(query, displayValues)
-
- // Sort by score (best matches first)
sort.Sort(matches)
// Reorder items based on fuzzy ranking