Skip to content

Clear the region on explicit terminal input - #682

Merged
dakra merged 1 commit into
mainfrom
fix/clear-region-on-input
Sep 13, 2026
Merged

dakra merged 1 commit into
mainfrom
fix/clear-region-on-input

Conversation

@dakra

@dakra dakra commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Fixes #674.

With ghostel-mouse-drag-input-mode set to nil, a mouse drag leaves the mark active in semi-char mode. Typing then writes to the PTY without touching the buffer, so nothing deactivates the mark, and the input hook snaps point to the live cursor: the region grows from the drag start to the prompt.

ghostel--on-user-input now calls deactivate-mark. It is the choke point for every explicit input path (self-insert, ghostel-send-key, paste, the C-c/C-d senders, middle-click paste, evil-ghostel's terminal-bound ESC), so typing dismisses a selection the way a terminal does. Copy/Emacs mode already deactivate on exit; line mode and evil visual operators never route through the hook.

Verified live under elate (zsh, Emacs 32 TTY): with the old body the region persists and extends to the prompt after a keystroke; with this change it clears and point lands on the cursor. The default copy-mode drag path still enters copy mode and exits cleanly on the next key.

Terminal input goes to the PTY, not the buffer, so a mouse selection
left active in semi-char mode (ghostel-mouse-drag-input-mode nil)
survived the keystroke and grew to the prompt when point snapped to
the live cursor.  Deactivate the mark in ghostel--on-user-input, the
choke point every explicit input path runs through.

Fixes #674.
@dakra
dakra merged commit 77d65fd into main Sep 13, 2026
27 checks passed
@dakra
dakra deleted the fix/clear-region-on-input branch September 13, 2026 11:51

This branch was successfully deployed

1 active deployment
github-pages — 77d65fdb Deployed Sep 13, 2026 by dakra via deploy #185
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.

Mouse selection extended after key input

1 participant