Add method to get the last line of a buffer

This commit is contained in:
John Lorentzson 2025-07-31 14:35:18 +02:00
parent 0451b5b7d1
commit b7dea0f333

View file

@ -454,6 +454,11 @@ serial connection the editor normally runs under.")
(buffer-view instance) (make-instance 'buffer-view :buffer instance)
(top-line (buffer-view instance)) (first-line instance)))
(defmethod last-line ((buffer buffer))
(loop :for line := (first-line buffer) :then (next-line buffer)
:until (null (next-line line))
:finally (return line)))
(defmethod buffer-string ((buffer buffer))
"Returns a string equivalent to BUFFER's contents."
(with-output-to-string (output)