]> git.eshelyaron.com Git - emacs.git/commitdiff
comint-fontify-input: Fix field boundary issue (bug#59626)
authorMiha Rihtaršič <miha@kamnitnik.top>
Sat, 26 Nov 2022 22:01:24 +0000 (23:01 +0100)
committerEli Zaretskii <eliz@gnu.org>
Wed, 7 Dec 2022 15:33:56 +0000 (17:33 +0200)
* lisp/comint.el (comint--intersect-regions): Don't call
'field-end' if we are on a field boundary already.

Copyright-paperwork-exempt: yes

lisp/comint.el

index 4d9fc5018742d6bd43ff2f19bacf64338e8c27bd..6742360d16b342a3386483e609a9d871cae4319d 100644 (file)
@@ -4121,9 +4121,15 @@ function called, or nil, if no function was called (if BEG = END)."
         (save-restriction
           (let ((beg2 beg1)
                 (end2 end1))
-            (when (= beg2 beg)
+            (when (and (= beg2 beg)
+                       (> beg2 (point-min))
+                       (eq is-output
+                           (eq (get-text-property (1- beg2) 'field) 'output)))
               (setq beg2 (field-beginning beg2)))
-            (when (= end2 end)
+            (when (and (= end2 end)
+                       (< end2 (point-max))
+                       (eq is-output
+                           (eq (get-text-property (1+ end2) 'field) 'output)))
               (setq end2 (field-end end2)))
             ;; Narrow to the whole field surrounding the region
             (narrow-to-region beg2 end2))