on main help sign in
feat(tui): show / hint when editor is empty (#1512)
commit47b50d4622eb65862e5d10fe78d5b444ea13e442 authorAmolith <amolith@secluded.site> dateWed 10 Dec 2025, 11:35 (1 year ago) parentee5e50a
2 files changed+9−1
internal/tui/components/chat/editor/editor.go+6−1 internal/tui/page/chat/chat.go+3
internal/tui/components/chat/editor/editor.go+6−1
@@ -41,6 +41,7 @@ type Editor interface {
4141 SetSession(session session.Session) tea.Cmd
4242 IsCompletionsOpen() bool
4343 HasAttachments() bool
44+ IsEmpty() bool
4445 Cursor() *tea.Cursor
4546}
4647
@@ -261,7 +262,7 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) {
261262 curIdx := m.textarea.Width()*cur.Y + cur.X
262263 switch {
263264 // Open command palette when "/" is pressed on empty prompt
264− case msg.String() == "/" && len(strings.TrimSpace(m.textarea.Value())) == 0:
265+ case msg.String() == "/" && m.IsEmpty():
265266 return m, util.CmdHandler(dialogs.OpenDialogMsg{
266267 Model: commands.NewCommandDialog(m.session.ID),
267268 })
@@ -542,6 +543,10 @@ func (c *editorCmp) HasAttachments() bool {
542543 return len(c.attachments) > 0
543544}
544545
546+func (c *editorCmp) IsEmpty() bool {
547+ return strings.TrimSpace(c.textarea.Value()) == ""
548+}
549+
545550func normalPromptFunc(info textarea.PromptInfo) string {
546551 t := styles.CurrentTheme()
547552 if info.LineNumber == 0 {
internal/tui/page/chat/chat.go+3
@@ -1024,6 +1024,9 @@ func (p *chatPage) Help() help.KeyMap {
10241024 key.WithKeys("ctrl+p"),
10251025 key.WithHelp("ctrl+p", "commands"),
10261026 )
1027+ if p.focusedPane == PanelTypeEditor && p.editor.IsEmpty() {
1028+ commandsBinding.SetHelp("/ or ctrl+p", "commands")
1029+ }
10271030 modelsBinding := key.NewBinding(
10281031 key.WithKeys("ctrl+m", "ctrl+l"),
10291032 key.WithHelp("ctrl+l", "models"),