Repository navigation
fix(tui): detach recalled history when removing an attachment or deleting in vim - #7143
Merged
Hmbown merged 3 commits intoOct 30, 2026
Merged
Conversation
…ting in vim Removing a selected attachment, vim `x` and vim `dd` edited the composer without clearing the recalled history entry, so the next Up/Down went on from the stale index and silently brought the original entry back. The other deletes already clear it (see the note on insert_str). Signed-off-by: Lstarsky0 <59827030+Lstarsky0@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Hmbown
enabled auto-merge (squash)
October 29, 2026 12:11
Hmbown
approved these changes
Oct 30, 2026
Hmbown
left a comment
Collaborator
There was a problem hiding this comment.
thank you so much - help on the up / down arrow behavior is soooo appreciated!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
After Up recalls an entry from prompt history, an edit is supposed to detach it: the note on
insert_strexplains that otherwise "the next Up/Down silently discards" the edit. Typing, Backspace and Delete, the word and line deletes, and kill and yank clear it, and e7e0a4d did the same for paste and the external editor. Among the edits that remove text, three don't: removing a selected attachment, and vim Normal-modexanddd. After any of them, Up/Down carry on from the old index, and going back to that entry brings it back as it was saved.Launch composer,
TERM_PROGRAM=iTerm.app, one key at a time, with a history offirst entryand a two-line entry that carries an image attachment. Typedraft, Up to recall the attachment entry, Up, Home, Up to select the attachment, then Backspace (status:Removed attachment: shots/a.png). Before:After:
With
composer_vim_mode = "vim"and a history offirst entry,second entry:k,0,xgivesecond entry. Thenk,jshowedfirst entryandsecond entryas saved; nowkrecallssecond entryandjcomes back toecond entry.ddon the second line of a recalledtwo/linesentry leavestwo;k,jbrought backtwo/linesand now come back totwo.Each of the three now calls
clear_input_history_navigation()like the other deletes. For the attachment it goes after the check that one is selected, because every Backspace and Delete callsremove_selected_composer_attachmentfirst. As with typing into a recalled entry, the draft from before the first Up (draftabove) is no longer what Down returns to; the edited entry is.Issue
No-Issue: removing an attachment or vim
x/ddon a recalled history entry is undone by the next Up/Down; I searched and found no issue for itHow I tested it
mainat 3690f9c in a pseudo-terminal with an empty HOME, a seededcomposer_history.jsonlandTERM_PROGRAM=iTerm.app, sending one key at a time on the launch composer; the rows above come from those runs.cargo nextest run -p codewhale-tui --lib: 13908 of 13912 passed, with the 477vim,composer,attachmentandhistorytests among them. The 4 failures are plugin import tests (three inplugins_dsh_tests, plusplugins_skill_tests::dsh_packages_import_through_the_reviewed_install_and_update_flow, all "composition reviewer is unavailable"); the same 4 fail onmainat 3690f9c without this change.cargo fmt --all -- --check,cargo clippy -p codewhale-tui --all-targets --all-featureswith CI's flags (also on 1.99),cargo check -p codewhale-tui --all-targetsandcargo +1.89.0 check -p codewhale-tui: clean.Checklist
maincargo fmt --allpasses, and tests cover new or changed behaviordocs/features.toml(cargo test -p codewhale-tui --test feature_registrychecks it) — n/a