Skip to content

fix(completion): exit insert mode on escape - #187

Merged
fcoury merged 1 commit into
mainfrom
fix/escape-completion-mode
Aug 13, 2026
Merged

fix(completion): exit insert mode on escape#187
fcoury merged 1 commit into
mainfrom
fix/escape-completion-mode

Conversation

@fcoury

@fcoury fcoury commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Autocomplete can remain the active dialog after filtering removes every candidate. The popup then renders nothing, but still intercepts Esc to close only the hidden dialog, requiring a second Esc to leave Insert mode.

Make completion Esc handling close the dialog and enter Normal mode as one action. This keeps the modal editing contract consistent whether completion candidates are visible or have filtered down to zero, and adds production-event coverage for the reported Python call sequence.

How to Test

  1. Run Red on a Python file containing a symbol such as manual_seed.
  2. In Insert mode, type torch.manual and wait for completion to appear.
  3. Finish typing _seed(1337) so the candidates disappear, then press Esc once.
  4. Verify the statusline changes directly to NORMAL and the completed text remains intact.
  5. With completion still visibly open, press Esc once and verify it also closes the popup and enters Normal mode.

Automated coverage:

  • cargo test --all-features
  • cargo clippy --all-targets --all-features -- -D warnings

@fcoury
fcoury merged commit e10465a into main Aug 13, 2026
16 checks passed
@fcoury
fcoury deleted the fix/escape-completion-mode branch August 13, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant