Function: csv-align--cursor-truncated
csv-align--cursor-truncated is a natively compiled function defined in
csv-mode.el.
Signature
(csv-align--cursor-truncated WINDOW OLDPOS DIR)
Source Code
;; Defined in /nix/store/3gmjnyw9n226b7k7jamikx980vf8267p-emacs-packages-deps/share/emacs/site-lisp/elpa/csv-mode-1.27/csv-mode.el
(defun csv-align--cursor-truncated (window oldpos dir)
;; FIXME: Neither the `entered' nor the `left' event are guaranteed
;; to be sent, and for the `left' case, even when we do get called,
;; it may be unclear where the revealed text was (it's somewhere around
;; `oldpos', but that position can be stale).
;; Worse, if we have several windows displaying the buffer, when one
;; cursor leaves we may need to keep the text revealed because of
;; another window's cursor.
(let* ((prop (if (eq dir 'entered) 'invisible 'csv--revealed))
(pos (cond
((eq dir 'entered) (window-point window))
(t (max (point-min)
(min (point-max)
(or oldpos (window-point window)))))))
(start (cond
((and (> pos (point-min))
(eq (get-text-property (1- pos) prop) 'csv-truncate))
(or (previous-single-property-change pos prop) (point-min)))
(t pos)))
(end (if (eq (get-text-property pos prop) 'csv-truncate)
(or (next-single-property-change pos prop) (point-max))
pos)))
(unless (eql start end)
(with-silent-modifications
(put-text-property start end
(if (eq dir 'entered) 'csv--revealed 'invisible)
'csv-truncate)
(remove-text-properties start end (list prop))))))