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

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

[nongnu] elpa/annotate b2cd959cfa 053/372: Annotations of long lines sta


From: ELPA Syncer
Subject: [nongnu] elpa/annotate b2cd959cfa 053/372: Annotations of long lines start at the next line
Date: Fri, 4 Feb 2022 16:58:18 -0500 (EST)

branch: elpa/annotate
commit b2cd959cfa28e93c2c29aa1b7a9a14af83cd8757
Author: Bastian Bechtold <basti@bastibe.de>
Commit: Bastian Bechtold <basti@bastibe.de>

    Annotations of long lines start at the next line
    
    fixes #27
---
 annotate.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/annotate.el b/annotate.el
index bef6ddf101..7b4dae9174 100644
--- a/annotate.el
+++ b/annotate.el
@@ -404,11 +404,12 @@ annotation plus the newline."
       (re-search-forward "\\(.*\\(\n\\)\\)")
       t)))
 
-(defun annotate-lineate (text)
+(defun annotate-lineate (text line-width)
   "Breaks `text` into lines to fit in the annotation space"
   (let ((available-width (- (window-body-width)
                             annotate-annotation-column))
-        (lineated "")
+        ;; if the annotation won't fit at the end of the line:
+        (lineated (if (< line-width annotate-annotation-column) "" "\n"))
         (current-pos 0))
     (while (< current-pos (string-width text))
       (setq lineated
@@ -440,7 +441,7 @@ annotation plus the newline."
       ;; put each annotation on its own line
       (dolist (ov overlays)
         (if (overlay-get ov 'annotation)
-            (dolist (l (save-match-data (split-string (annotate-lineate 
(overlay-get ov 'annotation)) "\n")))
+            (dolist (l (save-match-data (split-string (annotate-lineate 
(overlay-get ov 'annotation) (- eol bol)) "\n")))
               (setq text
                     (concat text prefix
                             (propertize l 'face 'annotate-annotation)



reply via email to

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