diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index d6b3528e7b91e8feded25b374b20f9a11dffc067..f954ced345095548508c7223f86c7a87e59c314a 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -264,8 +264,13 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) { cur := m.textarea.Cursor() curIdx := m.textarea.Width()*cur.Y + cur.X switch { + // Open command palette when "/" is pressed on empty prompt + case msg.String() == "/" && len(strings.TrimSpace(m.textarea.Value())) == 0: + return m, util.CmdHandler(dialogs.OpenDialogMsg{ + Model: commands.NewCommandDialog(m.session.ID), + }) // Completions - case msg.String() == "/" && !m.isCompletionsOpen && + case msg.String() == "@" && !m.isCompletionsOpen && // only show if beginning of prompt, or if previous char is a space or newline: (len(m.textarea.Value()) == 0 || unicode.IsSpace(rune(m.textarea.Value()[len(m.textarea.Value())-1]))): m.isCompletionsOpen = true @@ -337,7 +342,7 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) { cmds = append(cmds, util.CmdHandler(completions.CloseCompletionsMsg{})) } else { word := m.textarea.Word() - if strings.HasPrefix(word, "/") { + if strings.HasPrefix(word, "@") { // XXX: wont' work if editing in the middle of the field. m.completionsStartIndex = strings.LastIndex(m.textarea.Value(), word) m.currentQuery = word[1:] diff --git a/internal/tui/page/chat/chat.go b/internal/tui/page/chat/chat.go index 6039f17a469400d823078583f153e909f2650209..0664b65261fa61f491b624cd15e043d8c9791563 100644 --- a/internal/tui/page/chat/chat.go +++ b/internal/tui/page/chat/chat.go @@ -1037,8 +1037,8 @@ func (p *chatPage) Help() help.KeyMap { key.WithHelp("ctrl+f", "add image"), ), key.NewBinding( - key.WithKeys("/"), - key.WithHelp("/", "add file"), + key.WithKeys("@"), + key.WithHelp("@", "mention file"), ), key.NewBinding( key.WithKeys("ctrl+o"),