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).
This commit is contained in:
Jim Porter 2024-10-19 16:12:43 -07:00
parent 08f3bc1b8e
commit 81a5beb8af

View file

@ -165,6 +165,9 @@ PREFIX was empty."
;; first-line prefix.
(let ((avg-space (propertize (buffer-substring position (1+ position))
'display '(space :width 1))))
;; 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))))))))