Function: ghostel--forward-inserts-after-change
ghostel--forward-inserts-after-change is a natively compiled function
defined in ghostel.el.
Signature
(ghostel--forward-inserts-after-change BEG END OLD-LEN)
Documentation
Forward a foreign insertion BEG..END to the PTY and remove it from the buffer.
Text containing a line break is sent as a bracketed paste. An edit that removed renderer-owned text (OLD-LEN non-zero) is instead repaired by a full redraw restoring the terminal contents, with point realigned to the VT cursor.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--forward-inserts-after-change (beg end old-len)
"Forward a foreign insertion BEG..END to the PTY and remove it from the buffer.
Text containing a line break is sent as a bracketed paste. An edit that removed
renderer-owned text (OLD-LEN non-zero) is instead repaired by a full redraw
restoring the terminal contents, with point realigned to the VT cursor."
(when (ghostel--forward-inserts-p)
(if (> old-len 0)
(progn
(ghostel--redraw ghostel--term t t)
(ghostel--schedule-link-detection)
;; The reverted edit must not move point either; realign it.
(when ghostel--cursor-char-pos
(goto-char ghostel--cursor-char-pos)))
(when (> end beg)
(let ((text (buffer-substring-no-properties beg end)))
(delete-region beg end)
(ghostel--on-user-input)
(if (string-match-p "[\n\r]" text)
(ghostel--paste-text text)
(ghostel--send-string (encode-coding-string text 'utf-8))))))))