Function: ghostel--line-mode-apply-readonly

ghostel--line-mode-apply-readonly is a natively compiled function defined in ghostel-line-mode.el.

Signature

(ghostel--line-mode-apply-readonly MARKER-POS)

Documentation

Mark [point-min, MARKER-POS) read-only with the rear-nonsticky trick.

The non-sticky flag lands on the last protected character so insertion at MARKER-POS itself stays legal while edits inside the region still signal text-read-only. Setting rear-nonsticky to t also stops typed input from inheriting the prompt char's face
(and any other rendered-style properties libghostty painted on
it) — without this, text typed after a colored prompt picks up the prompt's color until RET.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-line-mode.el
(defun ghostel--line-mode-apply-readonly (marker-pos)
  "Mark `[point-min, MARKER-POS)' read-only with the rear-nonsticky trick.
The non-sticky flag lands on the last protected character so
insertion at MARKER-POS itself stays legal while edits inside the
region still signal `text-read-only'.  Setting `rear-nonsticky' to
t also stops typed input from inheriting the prompt char's `face'
\(and any other rendered-style properties libghostty painted on
it) — without this, text typed after a colored prompt picks up
the prompt's color until RET."
  (let ((inhibit-read-only t))
    (put-text-property (point-min) marker-pos 'read-only t)
    (when (> marker-pos (point-min))
      (put-text-property (1- marker-pos) marker-pos
                         'rear-nonsticky t))))