diff options
-rw-r--r-- | Core/clim/input-editing-drei.lisp | 8 | ||||
-rw-r--r-- | Core/extended-output/output-record.lisp | 4 | ||||
-rw-r--r-- | Core/extended-output/output-stream.lisp | 2 | ||||
-rw-r--r-- | Core/extended-output/text-cursor.lisp | 7 | ||||
-rw-r--r-- | Libraries/Drei/drei-clim.lisp | 2 | ||||
-rw-r--r-- | Libraries/Drei/drei-redisplay.lisp | 11 |
6 files changed, 19 insertions, 15 deletions
diff --git a/Core/clim/input-editing-drei.lisp b/Core/clim/input-editing-drei.lisp index 1ef253d1..cb7a5eae 100644 --- a/Core/clim/input-editing-drei.lisp +++ b/Core/clim/input-editing-drei.lisp @@ -66,12 +66,10 @@ activated with GESTURE")) (funcall input-sensitizer real-stream #'(lambda () - (stream-add-output-record real-stream record) - (when (stream-drawing-p real-stream) - (replay record real-stream))))) - ;; We still want to replay it for the cursor visibility change... + (stream-add-output-record real-stream record)))) + ;; We still want to repaint it for the cursor visibility change... ((stream-drawing-p real-stream) - (replay record real-stream) )) + (dispatch-repaint real-stream record))) ;; FIXME this causes a line break even on an empty input. A most notable ;; example is when the command is accepted with :ECHO NIL -- jd 2022-12-09 (setf (stream-cursor-position real-stream) diff --git a/Core/extended-output/output-record.lisp b/Core/extended-output/output-record.lisp index 9d4562ae..e770badc 100644 --- a/Core/extended-output/output-record.lisp +++ b/Core/extended-output/output-record.lisp @@ -1633,9 +1633,9 @@ the associated sheet can be determined." (defmethod replay-output-record ((self standard-text-displayed-output-record) stream &optional region (x-offset 0) (y-offset 0)) (declare (ignore region)) - (let ((cursor (stream-text-cursor stream))) + (let ((cursor (make-instance 'standard-text-cursor :sheet stream))) (update-cursor cursor (start-cursor self)) - (stream-increment-cursor-position stream x-offset y-offset) + (increment-cursor-position cursor x-offset y-offset) (with-identity-transformation (stream) (loop for record across (slot-value self 'objects) do (multiple-value-bind (x0 y0) (output-record-origin record) diff --git a/Core/extended-output/output-stream.lisp b/Core/extended-output/output-stream.lisp index 3377595d..9153ebf7 100644 --- a/Core/extended-output/output-stream.lisp +++ b/Core/extended-output/output-stream.lisp @@ -222,7 +222,7 @@ (setf (cursor-offset cursor) (values bx by)) (setf (cursor-extent cursor) (values ex ey)) (seos-record-output stream vector start split) - (when (/= split end) + (when (and split (/= split end)) (go :break-line)))))) diff --git a/Core/extended-output/text-cursor.lisp b/Core/extended-output/text-cursor.lisp index 61b6c492..93c56cdd 100644 --- a/Core/extended-output/text-cursor.lisp +++ b/Core/extended-output/text-cursor.lisp @@ -118,6 +118,13 @@ (cursor-extent target) (cursor-extent source)) target) +(defun increment-cursor-position (cursor dx dy) + (let ((dx (or dx 0)) + (dy (or dy 0))) + (multiple-value-bind (x y) (cursor-position cursor) + (setf (cursor-position cursor) + (values (+ x dx) (+ y dy)))))) + ;;; This macro is used to ensure that the cursor is restored to its old state ;;; after the operation. -- jd 2024-01-05 (defmacro with-cursor-off ((cursor) &body body) diff --git a/Libraries/Drei/drei-clim.lisp b/Libraries/Drei/drei-clim.lisp index 19bc92d4..23e9b922 100644 --- a/Libraries/Drei/drei-clim.lisp +++ b/Libraries/Drei/drei-clim.lisp @@ -518,7 +518,7 @@ record.")) (call-next-method))) (defmethod (setf active) :after (new-val (drei drei-area)) - (replay drei (editor-pane drei))) + (dispatch-repaint (editor-pane drei) drei)) (defmethod additional-command-tables append ((drei drei-area) (table drei-command-table)) `(exclusive-input-editor-table)) diff --git a/Libraries/Drei/drei-redisplay.lisp b/Libraries/Drei/drei-redisplay.lisp index 405d61f8..2f62033a 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 @@ -717,7 +719,7 @@ type (found via `presentation-type-of') to generate output." (setf (output-record-position output-record) (values (+ cursor-x 0.1) (- cursor-y baseline))) (when draw - (replay output-record stream)) + (dispatch-repaint stream output-record)) (setf (aref widths 1) width) (record-stroke stroke parts widths cursor-x (- cursor-y baseline) @@ -1088,14 +1090,11 @@ calculated by `drei-bounding-rectangle*'." (defmethod replay-output-record ((cursor drei-cursor) stream &optional (x-offset 0) (y-offset 0) (region +everywhere+)) (declare (ignore x-offset y-offset region)) - (with-output-recording-options (stream :record t :draw t) - (display-drei-view-cursor stream (view cursor) cursor))) + (display-drei-view-cursor stream (view cursor) cursor)) (defun display-drei-area (drei) (with-accessors ((stream editor-pane) (view view)) drei (with-bounding-rectangle* (old-x1 old-y1 old-x2 old-y2) drei - (with-output-recording-options (stream :draw nil) - (replay drei stream)) (with-bounding-rectangle* (new-x1 new-y1 new-x2 new-y2) drei (unless (or (and (= new-x1 old-x1) (= new-y1 old-y2) (= new-x2 old-x2) (= new-y2 old-y2)) |