From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 59626@debbugs.gnu.org
Subject: bug#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue
Date: Sun, 27 Nov 2022 10:23:57 +0100 [thread overview]
Message-ID: <875yf03g42.fsf@miha-pc> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 386 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-comint-fontify-input-Fix-field-boundary-issue.patch --]
[-- Type: text/x-patch, Size: 1406 bytes --]
From 5e2effcaf8d4b1f1cc835fae910e8d85abb7be3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@kamnitnik.top>
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next reply other threads:[~2022-11-27 9:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-27 9:23 miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-11-27 9:39 ` bug#59626: 29.0.50; [PATCH] comint-fontify-input: Fix field boundary issue Eli Zaretskii
2022-11-27 12:22 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-27 12:27 ` Eli Zaretskii
2022-12-07 15:43 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875yf03g42.fsf@miha-pc \
--to=bug-gnu-emacs@gnu.org \
--cc=59626@debbugs.gnu.org \
--cc=miha@kamnitnik.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.