From: Jim Porter Date: Sat, 19 Oct 2024 23:12:43 +0000 (-0700) Subject: Fix 'min-width' calculation in 'visual-wrap-prefix-mode' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0f60faf4ba5e1b4c7eb4d0c4ba416e54185b7ce;p=emacs.git 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). (cherry picked from commit 81a5beb8af020e4c92a77d61c8aa5e637e2dc945) --- 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 @@ PREFIX was empty." ;; 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.