Skip to content

feat(tui): include slash commands in composer Up-arrow history (recall /commands) #6006

Description

@7jrxt42BxFZo4iAnN4CX

Problem

Up-arrow recall (#366) works only for plain prompts. Slash commands are deliberately excluded from composer_history.txt (crates/tui/src/composer_history.rs:222, trimmed.starts_with('/')), so a previously used /theme, /compact, /mode work, etc. cannot be brought back with Up-arrow — I have to retype it. In opencode every /command lands in history and recalling it with Up-arrow is often faster than re-typing or opening the fuzzy slash menu.

While checking this I found a side effect of the same filter: absolute paths are also dropped. Anything starting with /cd /home/..., cat /etc/fstab — is never stored, so those lines can't be recalled either. That looks unintended: the intent was to skip slash commands, not slash-prefixed input in general.

Proposed change

Store slash commands in composer history, keeping the existing consecutive-duplicate dedup. crates/tui/src/composer_history.rs:225-227 already compares each new entry against the last one, so three /theme in a row recall as a single entry — no extra dedup work needed.

For the path collision: skip only recognized commands instead of every /-prefixed line, or store the raw stream and rely on dedup. Either way the Up-arrow recall path reads input_history directly (crates/tui/src/tui/app/composer.rs:674-691) with no further /-filtering, so this is a change on the write side only.

Use case

Retyping /theme or /compact mid-session is exactly the repetitious input Up-arrow exists for. opencode keeps commands in history; codewhale currently forces a retype.

References

  • #366 — original recall implementation; maintainer comment: "Slash commands, empty input, and consecutive duplicates are skipped to keep the recall stream clean."
  • crates/tui/src/composer_history.rs:222 (skip), :225-227 (dedup already present)
  • crates/tui/src/tui/app/composer.rs:674-691 (recall reads the file directly)

Question/open for discussion: this reverses an intentional design choice from #366, so happy to hear the reasoning for keeping commands out of recall — but on my usage the retype cost is real and opencode's behavior is more convenient.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions