Subject: bug#59626: closed (Re: bug#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 07 Dec 2022 15:45:03 +0000

Your bug report

#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59626: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59626
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue
From: Eli Zaretskii <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 07 Dec 2022 17:43:43 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Sun, 27 Nov 2022 10:23:57 +0100
> From: miha--- via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> Please find attached a patch which fixes a minor issue with narrowing to
> fields during comint input fontification. The issue didn't cause any
> visible bugs that I know of, I only noticed it during experimentation
> with tree-sitter integration.
> 
> Not that my copyright paperwork renewal is currently in progress, but I
> hope that the number of lines in this patch fall below the threshold.

Thanks, installed on the master branch, and closing the bug.

Subject: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue
From: [email-masked]
To: [email-masked]
Date: Sun, 27 Nov 2022 10:23:57 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Please find attached a patch which fixes a minor issue with narrowing to
fields during comint input fontification. The issue didn't cause any
visible bugs that I know of, I only noticed it during experimentation
with tree-sitter integration.

Not that my copyright paperwork renewal is currently in progress, but I
hope that the number of lines in this patch fall below the threshold.

From 5e2effcaf8d4b1f1cc835fae910e8d85abb7be3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <[email-masked]>
Date: Sat, 26 Nov 2022 23:01:24 +0100
Subject: [PATCH] comint-fontify-input: Fix field boundary issue

* lisp/comint.el (comint--intersect-regions): Don't call field-end if
we are on a field boundary already.
---
 lisp/comint.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index ddb3464891..f47e6089f2 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -4122,9 +4122,15 @@ comint--intersect-regions
         (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))
-- 
2.38.1