Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Aug 11, 2024
1 parent 4e7034d commit 0acd49d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
19 changes: 10 additions & 9 deletions extensions/lisp-mode/lisp-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,16 @@
(abort-all (current-connection) "change connection")
(notify-change-connection-to-wait-message-thread))
(setf (current-connection) connection)
(write-string-to-repl
(if (self-connection-p connection)
(format nil
"~%; changed connection (self connection)")
(format nil
"~%; changed connection (~A ~A)"
(connection-implementation-name connection)
(connection-implementation-version connection)))
:attribute 'syntax-comment-attribute))
(when (repl-buffer)
(write-string-to-repl
(if (self-connection-p connection)
(format nil
"~%; changed connection (self connection)")
(format nil
"~%; changed connection (~A ~A)"
(connection-implementation-name connection)
(connection-implementation-version connection)))
:attribute 'syntax-comment-attribute)))

(defmethod switch-connection ((connection connection))
(change-current-connection connection))
Expand Down
26 changes: 14 additions & 12 deletions extensions/lisp-mode/repl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@
(defun insert-repl-header (buffer self-connection)
(when self-connection
(insert-string (buffer-point buffer)
*welcome-text*)
*welcome-text*
:sticky-attribute 'syntax-comment-attribute)
(update-repl-buffer-write-point (buffer-end-point buffer))))

(defun make-repl-buffer (self-connection)
Expand Down Expand Up @@ -347,17 +348,18 @@
(defun call-with-repl-point (function)
(let* ((buffer (ensure-repl-buffer-exist))
(point (repl-buffer-write-point buffer)))
(cond (*repl-evaluating*
(buffer-end point))
(t
(when (point<= (lem/listener-mode:input-start-point buffer) point)
(move-point point (lem/listener-mode:input-start-point buffer))
(previous-single-property-change point :field))))
(unless (eq (current-buffer) buffer)
(see-repl-writing buffer))
(with-buffer-read-only buffer nil
(let ((*inhibit-read-only* t))
(funcall function point)))))
(when (lem/listener-mode:input-start-point buffer)
(cond (*repl-evaluating*
(buffer-end point))
(t
(when (point<= (lem/listener-mode:input-start-point buffer) point)
(move-point point (lem/listener-mode:input-start-point buffer))
(previous-single-property-change point :field))))
(unless (eq (current-buffer) buffer)
(see-repl-writing buffer))
(with-buffer-read-only buffer nil
(let ((*inhibit-read-only* t))
(funcall function point))))))

(defmacro with-repl-point ((point) &body body)
`(call-with-repl-point (lambda (,point) ,@body)))
Expand Down

0 comments on commit 0acd49d

Please sign in to comment.