org-fontify-extend-region: Fix edge case

* lisp/org.el (org-fontify-extend-region): Extend region for an extra
character, just as `font-lock-extend-jit-lock-region-after-change'
does.  This fixes a reported edge case.

Also, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68849

Reported-by: Kostas Papadakis <papadakis.k@yandex.com>
Link: https://orgmode.org/list/c5fb9f63-185c-4e36-b13f-e887a4a29aae@yandex.com
This commit is contained in:
Ihor Radchenko 2024-02-04 14:29:23 +01:00
parent 97f4ae0c2d
commit 1abff38597
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 1 deletions

View File

@ -5524,7 +5524,9 @@ by a #."
(defun org-fontify-extend-region (beg end _old-len)
(let ((end (if (progn (goto-char end) (looking-at-p "^[*#]"))
(1+ end) end))
(min (point-max) (1+ end))
;; See `font-lock-extend-jit-lock-region-after-change' and bug#68849.
(min (point-max) (1+ end))))
(begin-re "\\(\\\\\\[\\|\\(#\\+begin_\\|\\\\begin{\\)\\S-+\\)")
(end-re "\\(\\\\\\]\\|\\(#\\+end_\\|\\\\end{\\)\\S-+\\)")
(extend