From d3316fc006f6e8049c58f11df9e0a4786e543fe6 Mon Sep 17 00:00:00 2001 From: Daniel KochmaƄski Date: Tue, 17 Sep 2024 13:57:35 +0200 Subject: drei: don't assume that displayed-lines-count is correct Sometimes drei gets confused by itself with counting. --- Libraries/Drei/drei-redisplay.lisp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libraries/Drei/drei-redisplay.lisp b/Libraries/Drei/drei-redisplay.lisp index 405d61f8..20b94f6b 100644 --- a/Libraries/Drei/drei-redisplay.lisp +++ b/Libraries/Drei/drei-redisplay.lisp @@ -353,7 +353,9 @@ last line." error if there is no such line (note that even an empty buffer consists of a single line on display, as long as it has been redislayed at some point)." - (elt (displayed-lines view) (1- (displayed-lines-count view)))) + (let ((count (displayed-lines-count view))) + (when (plusp count) + (elt (displayed-lines view) (1- count))))) (defun ensure-line-stroke-information-size (line min-size) "Ensure that the array of strokes in `line' contains at least -- cgit v1.2.3-70-g09d2