aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Porter2024-10-19 16:12:43 -0700
committerJim Porter2024-10-19 21:28:37 -0700
commit81a5beb8af020e4c92a77d61c8aa5e637e2dc945 (patch)
treece559726db3c181c7a9b20df7905b4d5afe6fb54
parent08f3bc1b8e6a3583c8ccda02a7cf1b59c8d3f514 (diff)
downloademacs-81a5beb8af020e4c92a77d61c8aa5e637e2dc945.tar.gz
emacs-81a5beb8af020e4c92a77d61c8aa5e637e2dc945.zip
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).
-rw-r--r--lisp/visual-wrap.el9
1 files 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 @@ PREFIX was empty."
165 ;; first-line prefix. 165 ;; first-line prefix.
166 (let ((avg-space (propertize (buffer-substring position (1+ position)) 166 (let ((avg-space (propertize (buffer-substring position (1+ position))
167 'display '(space :width 1)))) 167 'display '(space :width 1))))
168 (max (string-width prefix) 168 ;; Remove any `min-width' display specs since we'll replace with
169 (ceiling (string-pixel-width prefix (current-buffer)) 169 ;; our own later in `visual-wrap--apply-to-line' (bug#73882).
170 (string-pixel-width avg-space (current-buffer)))))))) 170 (add-display-text-property 0 (length prefix) 'min-width nil prefix)
171 (max (string-width prefix)
172 (ceiling (string-pixel-width prefix (current-buffer))
173 (string-pixel-width avg-space (current-buffer))))))))
171 174
172(defun visual-wrap-fill-context-prefix (beg end) 175(defun visual-wrap-fill-context-prefix (beg end)
173 "Compute visual wrap prefix from text between BEG and END. 176 "Compute visual wrap prefix from text between BEG and END.