From 34b30b5e6067f670c95ed6c88ba9dcdfbe5bce93 Mon Sep 17 00:00:00 2001 From: dickmao Date: Wed, 23 Jan 2019 08:05:09 -0500 Subject: [PATCH] User llcc reports read-only bug in fresh input cell under mingw32 --- lisp/ein-cell.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/ein-cell.el b/lisp/ein-cell.el index 6de2887..0f94341 100644 --- a/lisp/ein-cell.el +++ b/lisp/ein-cell.el @@ -520,16 +520,20 @@ Return language name as a string or `nil' when not defined. (cl-defmethod ein:cell-insert-input ((cell ein:basecell)) "Insert input of the CELL in the buffer. Called from ewoc pretty printer via `ein:cell-pp'." - (let ((start (1+ (point)))) + (let ((start (1+ (point))) pos-newline) ;; Newlines must allow insertion before/after its position. - (insert (propertize "\n" 'read-only t 'rear-nonsticky t) - (or (ein:oref-safe cell 'input) "") + (insert (propertize "\n" 'read-only t 'rear-nonsticky t)) + (setq pos-newline (1- (point))) + (insert (or (ein:oref-safe cell 'input) "") (propertize "\n" 'read-only t)) ;; Highlight background using overlay. (let ((ol (make-overlay start (point)))) (overlay-put ol 'face (ein:cell-get-input-area-face cell)) ;; `evaporate' = `t': Overlay is deleted when the region become empty. - (overlay-put ol 'evaporate t)))) + (overlay-put ol 'evaporate t)) + (unless (get-text-property pos-newline 'rear-nonsticky) + (put-text-property pos-newline (1+ pos-newline) 'rear-nonsticky t) + (ein:log 'debug "ein:cell-insert-input: missing rear-nonsticky at %s" pos-newline)))) (cl-defmethod ein:cell-get-input-area-face ((cell ein:basecell)) "Return the face (symbol) for input area."