Function: ghostel--cursor-row-text

ghostel--cursor-row-text is a natively compiled function defined in ghostel.el.

Signature

(ghostel--cursor-row-text)

Documentation

Return the text of the row containing the terminal cursor, or nil.

The text is taken from the buffer (post-redraw), without text properties, with trailing whitespace trimmed. Returns nil for the empty row so callers can pass the result through or to a default.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--cursor-row-text ()
  "Return the text of the row containing the terminal cursor, or nil.
The text is taken from the buffer (post-redraw), without text
properties, with trailing whitespace trimmed.  Returns nil for
the empty row so callers can pass the result through `or' to a
default."
  (when ghostel--term
    (let ((pos ghostel--cursor-pos)
          (vp-start (ghostel--viewport-start)))
      (when (and pos vp-start)
        (save-excursion
          (goto-char vp-start)
          (forward-line (cdr pos))
          (let ((line (string-trim-right
                       (buffer-substring-no-properties
                        (line-beginning-position) (line-end-position)))))
            (and (not (string-empty-p line)) line)))))))