branch: externals/coterm
commit 5e40af4df3c08bf37de9d57c24b4ceeb946b1c20
Author: m <>
Commit: m <>

    Prevent modification of user input harder
---
 coterm.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/coterm.el b/coterm.el
index 2c61ce7..b6c46cf 100644
--- a/coterm.el
+++ b/coterm.el
@@ -500,11 +500,15 @@ buffer and the scrolling region must cover the whole 
screen."
           (coterm--t-adjust-from-pmark pmark)
           (save-restriction
             (widen)
-            (unless (text-property-any
-                     pmark (point-max) 'field 'output)
-              ;; If pmark is at the end of buffer, not counting user input,
-              ;; prevent changing this user input by narrowing the buffer
-              (narrow-to-region (point-min) pmark))
+            (goto-char (point-max))
+            ;; Use narrowing to prevent modification of user input at end of
+            ;; buffer
+            (unless (eq (get-char-property (max 1 (1- (point-max))) 'field)
+                        'output)
+              (goto-char (point-max))
+              (text-property-search-backward 'field 'output)
+              (when (<= pmark (point))
+                (narrow-to-region (point-min) (point))))
 
             (while (setq match (string-match coterm--t-control-seq-regexp
                                              string ctl-end))

Reply via email to