Skip to content

Let the Escape key cancel completion popups#1555

Merged
rolandwalker merged 1 commit intomainfrom
RW/let-escape-cancel-completion-poppups
Feb 16, 2026
Merged

Let the Escape key cancel completion popups#1555
rolandwalker merged 1 commit intomainfrom
RW/let-escape-cancel-completion-poppups

Conversation

@rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Feb 14, 2026

Description

There is some lag as compared to canceling with control-g, due to the VT-100 limitation of representing Alt- keypresses as Escape- sequences.

Mentioned in #1009.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Feb 14, 2026
Copy link
Contributor

@scottnemes scottnemes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified escape key exits completions after a brief delay

There is some lag as compared to canceling with control-g, due to the
VT-100 limitation of representing Alt- keypresses as Escape- sequences.
@rolandwalker rolandwalker force-pushed the RW/let-escape-cancel-completion-poppups branch from 9194617 to e5c4221 Compare February 16, 2026 09:47
@github-actions
Copy link

Summary: One potential regression around Alt- keybindings while the completion menu is open. No security concerns spotted.

Findings

  1. Potential regression: Escape is bound with eager=True while completion is active. This will consume the leading Escape in Alt- sequences, so Alt-r and Alt-Enter will no longer work when the completion menu is open. Previously those bindings should have fired even with completions visible. Consider dropping eager=True, or handling Alt- sequences explicitly so they still work after canceling. File: mycli/key_bindings.py:70.

Missing tests or edge cases

  1. No automated coverage for keybindings. If you keep the eager=True behavior, please add a test (or a small integration-style check) to assert expected behavior for Escape cancel and for Alt-r/Alt-Enter when completions are active, so the intended UX is locked in.

If you want, I can propose a concrete change to preserve Alt- bindings while still allowing Escape to cancel.

@rolandwalker rolandwalker merged commit e54c688 into main Feb 16, 2026
10 checks passed
@rolandwalker rolandwalker deleted the RW/let-escape-cancel-completion-poppups branch February 16, 2026 09:53
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.

2 participants