Function: ghostel--kitty-clear
ghostel--kitty-clear is a natively compiled function defined in
ghostel-kitty.el.
Signature
(ghostel--kitty-clear)
Documentation
Remove kitty image overlays and per-line clamps from the viewport.
Both display paths tag the regions/overlays with the ghostel-kitty
property so this strips only kitty-applied display and line-height,
leaving other consumers of display (e.g. wide-char compensation)
alone.
Only the viewport region is cleared — overlays on rows that have
already been promoted to materialized scrollback are preserved so
images stay visible after they scroll past the live viewport.
libghostty stops reporting placements once they're fully out of the
viewport (viewport_visible goes false), so wiping scrollback would
leave nothing to re-emit and the image would vanish from history.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-kitty.el
(defun ghostel--kitty-clear ()
"Remove kitty image overlays and per-line clamps from the viewport.
Both display paths tag the regions/overlays with the `ghostel-kitty'
property so this strips only kitty-applied `display' and `line-height',
leaving other consumers of `display' (e.g. wide-char compensation)
alone.
Only the viewport region is cleared — overlays on rows that have
already been promoted to materialized scrollback are preserved so
images stay visible after they scroll past the live viewport.
libghostty stops reporting placements once they're fully out of the
viewport (`viewport_visible' goes false), so wiping scrollback would
leave nothing to re-emit and the image would vanish from history."
(when ghostel--kitty-active
(let* ((inhibit-read-only t)
(vp-start (or (ghostel--viewport-start) (point-min)))
(end (point-max))
(pos vp-start))
(dolist (ov (overlays-in pos end))
(when (and (overlay-get ov 'ghostel-kitty)
(>= (overlay-start ov) pos))
(delete-overlay ov)))
(while (< pos end)
(let ((next (next-single-property-change pos 'ghostel-kitty nil end)))
(when (get-text-property pos 'ghostel-kitty)
(remove-text-properties
pos next '(display nil line-height nil ghostel-kitty nil)))
(setq pos next)))
;; Drop any image fragment left over by scrollback eviction (see
;; `ghostel--kitty-strip-orphan-top').
(ghostel--kitty-strip-orphan-top)
;; Sticky-flag hygiene: once we've stripped the viewport, anything
;; remaining must be in scrollback. If there's nothing left at all,
;; clear the flag so future redraws skip the buffer scan entirely.
(unless (ghostel--kitty-any-remaining-p (point-min) vp-start)
(setq ghostel--kitty-active nil)))))