From 432ac5b4fd4a5f15b0ae59d739ed2dd2b2e38a05 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Thu, 3 Oct 2024 17:24:18 -0700 Subject: [PATCH] Don't add visual-wrap-prefix properties to multiline display specs This makes sure we don't interfere with other display specs, e.g. for images displayed in 'image-mode' (bug#73600). * lisp/visual-wrap.el (visual-wrap--apply-to-line): Bail out if we're in the middle of a multi-line display spec --- lisp/visual-wrap.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el index 76276c0f474..af0b4fc8b0f 100644 --- a/lisp/visual-wrap.el +++ b/lisp/visual-wrap.el @@ -117,7 +117,16 @@ visual-wrap--apply-to-line "Apply visual-wrapping properties to the logical line starting at POSITION." (save-excursion (goto-char position) - (when-let ((first-line-prefix (fill-match-adaptive-prefix)) + (when-let (;; Don't add wrapping properties if we're in the middle + ;; of a multi-line display spec; it could be doing + ;; absolutely anything, and we don't want to interfere. + ;; (For example, this could be an image containing a + ;; newline-byte being displayed in `image-mode'; see + ;; bug#73600.) + ((or (= position (point-min)) + (not (eq (get-char-property position 'display) + (get-char-property (1- position) 'display))))) + (first-line-prefix (fill-match-adaptive-prefix)) (next-line-prefix (visual-wrap--content-prefix first-line-prefix position))) (when (numberp next-line-prefix) -- 2.25.1