emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/racket-mode 6b832a34bd: racket-repl-clear-output: Fix some


From: ELPA Syncer
Subject: [nongnu] elpa/racket-mode 6b832a34bd: racket-repl-clear-output: Fix some edge cases
Date: Tue, 21 Nov 2023 19:00:18 -0500 (EST)

branch: elpa/racket-mode
commit 6b832a34bd8d3fae40b8c02a71c74123f81e75b9
Author: Greg Hendershott <git@greghendershott.com>
Commit: Greg Hendershott <git@greghendershott.com>

    racket-repl-clear-output: Fix some edge cases
    
    Work for position immediately after a "run" field.
    
    Delete a possible \n with nil field prop value after stdout/stderr.
    
    Show a user-error when we can't find any output to delete.
---
 racket-repl.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/racket-repl.el b/racket-repl.el
index f7edbe212e..6856011aef 100644
--- a/racket-repl.el
+++ b/racket-repl.el
@@ -1586,9 +1586,10 @@ output."
          (output-fields '(value stdout stderr))
          (beg-of-output (progn
                           ;; Skip backward over non-output fields
-                          (while (and (not (bobp))
-                                      (not (memq (field-at-pos (point)) 
output-fields)))
-                            (goto-char (field-beginning (point) t)))
+                          (unless (memq (get-text-property (point) 'field) 
output-fields)
+                            (while (and (not (bobp))
+                                        (not (memq (field-at-pos (point)) 
output-fields)))
+                              (goto-char (field-beginning (point) t))))
                           ;; Skip backward over output fields
                           (while (and (not (bobp))
                                       (memq (field-at-pos (point)) 
output-fields))
@@ -1596,7 +1597,12 @@ output."
                           (point)))
          (end-of-output (progn
                           (while (and (not (eobp))
-                                      (memq (field-at-pos (1+ (point))) 
output-fields))
+                                      (or (memq (field-at-pos (1+ (point))) 
output-fields)
+                                          ;; After stdout/stderr there
+                                          ;; might be a \n with nil
+                                          ;; field property.
+                                          (and (not (field-at-pos (1+ 
(point))))
+                                               (eq ?\n (char-after)))))
                             (goto-char (field-end (point) t)))
                           (point))))
     (if (< beg-of-output end-of-output)
@@ -1607,6 +1613,7 @@ output."
             (insert (propertize "(output deleted)\n"
                                 'read-only t
                                 'font-lock-face racket-repl-message))))
+      (user-error "Can't find output to delete")
       (goto-char pt))))
 
 ;;; Input history



reply via email to

[Prev in Thread] Current Thread [Next in Thread]