emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/annotate 85d7c87e08 293/372: - added padding also for note


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 85d7c87e08 293/372: - added padding also for notes placed on the margin of the window.
Date: Fri, 4 Feb 2022 16:59:09 -0500 (EST)

branch: elpa/annotate
commit 85d7c87e083dbc6c4bc7082c8331a973049e794a
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - added padding also for notes placed on the margin of the window.
---
 annotate.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/annotate.el b/annotate.el
index 582127d439..07a96c0aa8 100644
--- a/annotate.el
+++ b/annotate.el
@@ -922,7 +922,7 @@ to 'maximum-width'."
                                   (append (list prefix)
                                           so-far))))))
               (%split-words (text)
-                (save-match-data (split-string text " " t))))
+                (save-match-data (split-string text "[[:space:]]" t))))
     (if (< maximum-width 1)
         nil
       (let* ((words   (%split-words text))
@@ -1007,8 +1007,8 @@ aa   ->  aa*
 a        a**
 "
   (let ((annotation-text (overlay-get annotation-overlay 'annotation)))
-    (cl-labels ((boxify-multiline ()
-                  (let* ((lines         (annotate--split-lines 
annotation-text))
+    (cl-labels ((boxify-multiline (raw-annotation-text &optional 
add-space-at-end)
+                  (let* ((lines         (annotate--split-lines 
raw-annotation-text))
                          (lines-widths  (mapcar 'string-width lines))
                          (max-width     (cl-reduce (lambda (a b) (if (> a b)
                                                                      a
@@ -1023,11 +1023,15 @@ a        a**
                          (box-lines     (cl-mapcar (lambda (a b) (concat a b))
                                                    lines paddings))
                          (almost-boxed  (annotate--join-with-string box-lines 
"\n")))
-                    (concat almost-boxed " "))))
+                    (if add-space-at-end
+                        (concat almost-boxed " ")
+                      almost-boxed))))
       (if annotation-on-is-own-line-p
-          (list (boxify-multiline))
-        (annotate--split-lines (annotate-lineate annotation-text
-                                                 (- end-of-line 
begin-of-line)))))))
+          (list (boxify-multiline annotation-text t))
+        (let* ((lineated         (annotate-lineate annotation-text
+                                                   (- end-of-line 
begin-of-line)))
+               (boxed            (boxify-multiline lineated nil)))
+          (annotate--split-lines boxed))))))
 
 (defun annotate--annotation-builder ()
   "Searches the line before point for annotations, and returns a



reply via email to

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