ghostel-mode: bind clipboard media keys (XF86Paste/Copy/Cut)#134
ghostel-mode: bind clipboard media keys (XF86Paste/Copy/Cut)#134dakra merged 1 commit intodakra:mainfrom
Conversation
|
Thanks. (Maybe it's all not worth it and I'll merge this anyway.. but just leaving it open for a bit) |
|
Thanks for taking the time to think it through. A few notes on the vterm vs ghostel keymap model. vterm forwards-by-default: anything Given that, the natural "just works" path is the darwin pattern On cut. The |
Route <XF86Paste> through ghostel-yank (mirroring C-y and darwin s-v) and map <XF86Copy> to kill-ring-save. Without explicit bindings these fall through to the global yank/kill-region, which write to the Emacs buffer and get overpainted by the next redraw.
28b8c8b to
65932e6
Compare
|
I just removed the |
Problem
Linux keyboards with dedicated clipboard keys emit
<XF86Paste>,<XF86Copy>, and<XF86Cut>. Without explicit bindings onghostel-mode-map, they fall through to the global map and run thevanilla Emacs commands — which gives the wrong result inside a live
terminal:
yankinserts into the Emacs buffer; the next libghostty redrawoverpaints the viewport, so the paste silently disappears.
kill-regiondeletes text that the next redraw re-paints anyway,so cut looks like a no-op — while populating the kill ring with
text the user didn't actually want to remove.
By contrast, keyboards with Cmd-based clipboard keys already work
because the
darwinblock bindss-v→ghostel-yank.Reproduction
On a Linux session with a keyboard that emits XF86 media keys, focus a
ghostel buffer, put something in the kill ring, and press the hardware
Paste key. Nothing reaches the shell; a brief flicker of the pasted
text may appear in the Emacs buffer before the next redraw.
Fix
Bind the three XF86 clipboard keys explicitly on
ghostel-mode-map:<XF86Paste>→ghostel-yank(mirrorsC-yand darwins-v).<XF86Copy>→kill-ring-save(region from the buffer to kill ring).<XF86Cut>→kill-ring-save(live terminal output can't reallybe cut; degenerating to copy matches native ghostty).