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

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

[nongnu] elpa/annotate 4890d2d2a2 295/372: Merge pull request #95 from c


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 4890d2d2a2 295/372: Merge pull request #95 from cage2/master
Date: Fri, 4 Feb 2022 16:59:09 -0500 (EST)

branch: elpa/annotate
commit 4890d2d2a208689c6214d0e1c0a6fd034e9b4253
Merge: d4eff870d9 6415fb6111
Author: cage2 <1257703+cage2@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #95 from cage2/master
    
    Improving visuals of margin notes
---
 Changelog   |  6 ++++++
 NEWS.org    |  7 ++++++-
 annotate.el | 22 +++++++++++++---------
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/Changelog b/Changelog
index ed05a988b3..8312e68feb 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,9 @@
+2021-01-14 cage
+
+        * annotate.el:
+
+       - added padding also for notes placed on the margin of the window.
+
 2021-01-06  cage
 
         * annotate.el:
diff --git a/NEWS.org b/NEWS.org
index cfb3629261..f32b0dd658 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -178,7 +178,12 @@
   Related to the last  fix the variable ~annotate-diff-export-context~
   has been removed.
 
-* 2021-01-06 V1.1.1 Bastian Bechtold, cage ::
+- 2021-01-06 V1.1.1 Bastian Bechtold, cage ::
 
   This version  fix an old bug  that causes many types  of issues with
   rendering of annotations on the margin of the window.
+
+- 2021-01-06 V1.1.2 Bastian Bechtold, cage ::
+
+  This  version improves  visual  of multilined  notes  placed on  the
+  window margins.
diff --git a/annotate.el b/annotate.el
index 582127d439..db0fd1540f 100644
--- a/annotate.el
+++ b/annotate.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Bastian Bechtold
 ;; URL: https://github.com/bastibe/annotate.el
 ;; Created: 2015-06-10
-;; Version: 1.1.1
+;; Version: 1.1.2
 
 ;; This file is NOT part of GNU Emacs.
 
@@ -58,7 +58,7 @@
 ;;;###autoload
 (defgroup annotate nil
   "Annotate files without changing them."
-  :version "1.1.1"
+  :version "1.1.2"
   :group 'text)
 
 ;;;###autoload
@@ -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]