Skip to content

Commit 5813e3b

Browse files
committed
feat: add "quit" and ":q" as exit aliases, matching opencode behavior
Add "quit" and ":q" as bare keywords (alongside "exit") that quit the session immediately. Also register /quit and /q as slash command aliases for /exit. The bare keyword check is now case-sensitive, matching opencode's implementation.
1 parent 5cc3857 commit 5813e3b

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

pkg/tui/commands/commands.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,26 @@ func builtInSessionCommands() []Item {
107107
return core.CmdHandler(messages.ExitSessionMsg{})
108108
},
109109
},
110+
{
111+
ID: "session.quit",
112+
Label: "Quit",
113+
SlashCommand: "/quit",
114+
Description: "Quit the application (alias for /exit)",
115+
Category: "Session",
116+
Execute: func(string) tea.Cmd {
117+
return core.CmdHandler(messages.ExitSessionMsg{})
118+
},
119+
},
120+
{
121+
ID: "session.q",
122+
Label: "Quit (short)",
123+
SlashCommand: "/q",
124+
Description: "Quit the application (alias for /exit)",
125+
Category: "Session",
126+
Execute: func(string) tea.Cmd {
127+
return core.CmdHandler(messages.ExitSessionMsg{})
128+
},
129+
},
110130
{
111131
ID: "session.export",
112132
Label: "Export",

pkg/tui/page/chat/chat.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,10 @@ func (p *chatPage) cancelStream(showCancelMessage bool) tea.Cmd {
624624
// handleSendMsg handles incoming messages from the editor, either processing
625625
// them immediately or queuing them if the agent is busy.
626626
func (p *chatPage) handleSendMsg(msg msgtypes.SendMsg) (layout.Model, tea.Cmd) {
627-
// Handle "exit" as a special keyword to quit the session immediately,
628-
// equivalent to the /exit slash command.
629-
if strings.TrimSpace(strings.ToLower(msg.Content)) == "exit" {
627+
// Handle "exit", "quit", and ":q" as special keywords to quit the session
628+
// immediately, equivalent to the /exit slash command.
629+
switch strings.TrimSpace(msg.Content) {
630+
case "exit", "quit", ":q":
630631
return p, core.CmdHandler(msgtypes.ExitSessionMsg{})
631632
}
632633

0 commit comments

Comments
 (0)