Skip to content

Bind <xterm-paste> to appropriate handler #172

Description

@vkz

The likes of vterm would bind <xterm-paste> to the appropriate handler like e.g. vterm-xterm-paste which would pull stuff from the clipboard rather than the kill ring. I think ghostel may still be missing that. I'm sure you'd have thoughts on the matter so that's an issue rather than a PR. FWIW I just did silly thing that kinda works:

(defun fullmeta-ghostel-xterm-paste (event)
  "Send `<xterm-paste>' EVENT text to the terminal via bracketed paste.

Unlike plain `xterm-paste', this forwards the terminal-provided paste
payload to the Ghostel subprocess instead of inserting it into the
Emacs buffer, which would be lost on the next redraw.  When
`xterm-store-paste-on-kill-ring' is non-nil, also push the pasted text
onto the kill ring so subsequent Emacs yanks can reuse it."
  (interactive "e")
  (unless (eq (car-safe event) 'xterm-paste)
    (user-error "Expected an xterm-paste event, got: %S" event))
  (when ghostel--copy-mode-active
    (ghostel-copy-mode-exit))
  (when-let ((text (nth 1 event)))
    (when xterm-store-paste-on-kill-ring
      (kill-new text))
    (ghostel--paste-text text)))

(define-key ghostel-mode-map (kbd "<xterm-paste>") #'fullmeta-ghostel-xterm-paste)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions