diff options
author | Daniel Kochmański <daniel@turtleware.eu> | 2024-09-12 12:57:48 +0200 |
---|---|---|
committer | Daniel Kochmański <daniel@turtleware.eu> | 2024-09-17 14:22:39 +0200 |
commit | b06118543b0218c73fe356a88fdaa9464d41f6f5 (patch) | |
tree | b0ab7d8fee74df70d8269b242913987ba7ee5df8 | |
parent | 827b766948acb8c850d680fa7730e7071d4599f4 (diff) |
seos: STREAM-TEXT-CURSOR is not used when replaying
This is to avoid a situation, where we concurrently change its position.
-rw-r--r-- | Core/extended-output/output-record.lisp | 4 | ||||
-rw-r--r-- | Core/extended-output/text-cursor.lisp | 7 |
2 files changed, 9 insertions, 2 deletions
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/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) |