on main help sign in
feat(tui/chat): use @ for files, / for commands (#1377)
commit757d8232d86649129ddb590948c46df0e2fbdbbf authorAmolith <amolith@secluded.site> dateTue 4 Nov 2025, 10:48 (1 year ago) parent87bf27c
2 files changed+9−4
internal/tui/components/chat/editor/editor.go+7−2 internal/tui/page/chat/chat.go+2−2
internal/tui/components/chat/editor/editor.go+7−2
@@ -264,8 +264,13 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) {
264264 cur := m.textarea.Cursor()
265265 curIdx := m.textarea.Width()*cur.Y + cur.X
266266 switch {
267+ // Open command palette when "/" is pressed on empty prompt
268+ case msg.String() == "/" && len(strings.TrimSpace(m.textarea.Value())) == 0:
269+ return m, util.CmdHandler(dialogs.OpenDialogMsg{
270+ Model: commands.NewCommandDialog(m.session.ID),
271+ })
267272 // Completions
268− case msg.String() == "/" && !m.isCompletionsOpen &&
273+ case msg.String() == "@" && !m.isCompletionsOpen &&
269274 // only show if beginning of prompt, or if previous char is a space or newline:
270275 (len(m.textarea.Value()) == 0 || unicode.IsSpace(rune(m.textarea.Value()[len(m.textarea.Value())-1]))):
271276 m.isCompletionsOpen = true
@@ -337,7 +342,7 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) {
337342 cmds = append(cmds, util.CmdHandler(completions.CloseCompletionsMsg{}))
338343 } else {
339344 word := m.textarea.Word()
340− if strings.HasPrefix(word, "/") {
345+ if strings.HasPrefix(word, "@") {
341346 // XXX: wont' work if editing in the middle of the field.
342347 m.completionsStartIndex = strings.LastIndex(m.textarea.Value(), word)
343348 m.currentQuery = word[1:]
internal/tui/page/chat/chat.go+2−2
@@ -1037,8 +1037,8 @@ func (p *chatPage) Help() help.KeyMap {
10371037 key.WithHelp("ctrl+f", "add image"),
10381038 ),
10391039 key.NewBinding(
1040− key.WithKeys("/"),
1041− key.WithHelp("/", "add file"),
1040+ key.WithKeys("@"),
1041+ key.WithHelp("@", "mention file"),
10421042 ),
10431043 key.NewBinding(
10441044 key.WithKeys("ctrl+o"),