From 727abc3fbb8d43de78a9acf47aa4fb3a97bbb21a Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sat, 19 Oct 2024 16:12:43 -0700 Subject: [PATCH] Fix 'min-width' calculation in 'visual-wrap-prefix-mode' * lisp/visual-wrap.el (visual-wrap--content-prefix): Remove 'min-width' before computing the pixel width to avoid miscalculation (bug#73882). --- lisp/visual-wrap.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el index 76276c0f474..fa128d287a4 100644 --- a/lisp/visual-wrap.el +++ b/lisp/visual-wrap.el @@ -165,9 +165,12 @@ visual-wrap--content-prefix ;; first-line prefix. (let ((avg-space (propertize (buffer-substring position (1+ position)) 'display '(space :width 1)))) - (max (string-width prefix) - (ceiling (string-pixel-width prefix (current-buffer)) - (string-pixel-width avg-space (current-buffer)))))))) + ;; Remove any `min-width' display specs since we'll replace with + ;; our own later in `visual-wrap--apply-to-line' (bug#73882). + (add-display-text-property 0 (length prefix) 'min-width nil prefix) + (max (string-width prefix) + (ceiling (string-pixel-width prefix (current-buffer)) + (string-pixel-width avg-space (current-buffer)))))))) (defun visual-wrap-fill-context-prefix (beg end) "Compute visual wrap prefix from text between BEG and END. -- 2.25.1