emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 135da3556bb: Be more careful about aligning prefix lines in 'visu


From: Jim Porter
Subject: master 135da3556bb: Be more careful about aligning prefix lines in 'visual-wrap-prefix-mode'
Date: Sat, 17 Aug 2024 21:39:29 -0400 (EDT)

branch: master
commit 135da3556bb34bb20a01e02b30bc949c1a45b6cd
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    Be more careful about aligning prefix lines in 'visual-wrap-prefix-mode'
    
    * lisp/visual-wrap.el (visual-wrap--apply-to-line): Ensure we don't
    apply the 'min-width' property across multiple lines (bug#72681).
---
 lisp/visual-wrap.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el
index cac3bc767b8..16d330c2a93 100644
--- a/lisp/visual-wrap.el
+++ b/lisp/visual-wrap.el
@@ -121,9 +121,15 @@ extra indent = 2
                (next-line-prefix (visual-wrap--content-prefix
                                   first-line-prefix position)))
       (when (numberp next-line-prefix)
+        ;; Set a minimum width for the prefix so it lines up correctly
+        ;; with subsequent lines.  Make sure not to do this past the end
+        ;; of the line though!  (`fill-match-adaptive-prefix' could
+        ;; potentially return a prefix longer than the current line in
+        ;; the buffer.)
         (put-text-property
-         position (+ position (length first-line-prefix)) 'display
-         `(min-width ((,next-line-prefix . width)))))
+         position (min (+ position (length first-line-prefix))
+                       (line-end-position))
+         'display `(min-width ((,next-line-prefix . width)))))
       (setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
       (put-text-property
        position (line-end-position) 'wrap-prefix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]