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

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

[nongnu] elpa/annotate 3415b7ac08 321/372: - changed behaviour when user


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 3415b7ac08 321/372: - changed behaviour when user is annotation a newline character;
Date: Fri, 4 Feb 2022 16:59:15 -0500 (EST)

branch: elpa/annotate
commit 3415b7ac0841397d1e00cc0d169f60c831f88965
Author: cage <cage@localhost>
Commit: cage <cage@invalid>

    - changed behaviour when user is annotation a newline character;
    
      update an existing annotation on the line that terminate with the newline
      the user is annotation only if the existing annotation spans the whole 
line.
---
 annotate.el | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/annotate.el b/annotate.el
index dc32b61377..908f44e875 100644
--- a/annotate.el
+++ b/annotate.el
@@ -604,24 +604,30 @@ specified by `from' and `to'."
                       (annotate--cut-left-annotation last-of-chain-to-cut)))
                   (when delete-enclosed
                     (annotate-delete-chains-in-region chain-end region-stop))))
+              (annotate-overwrite-line (eol bol)
+                 (goto-char bol)
+                 (push-mark (point) t t)
+                 (goto-char eol)
+                 (annotate-annotate))
               (annotate-line (eol)
                 (let* ((bol                     
(annotate-beginning-of-line-pos))
                        (annotations-on-the-line 
(annotate-annotations-overlay-in-range bol
                                                                                
        eol)))
                   (if (= (length annotations-on-the-line)
                          1)
-                      (let* ((annotation    (cl-first annotations-on-the-line))
-                             (start-overlay (overlay-start annotation))
-                             (end-overlay   (overlay-end   annotation)))
-                        (goto-char end-overlay)
-                        (push-mark start-overlay t t)
-                        (annotate-change-annotation (overlay-start annotation))
-                        (pop-mark))
-                    (progn
-                      (goto-char bol)
-                      (push-mark (point) t t)
-                      (goto-char eol)
-                      (annotate-annotate))))))
+                      (let* ((annotation                    (cl-first 
annotations-on-the-line))
+                             (start-overlay                 (overlay-start 
annotation))
+                             (end-overlay                   (overlay-end   
annotation))
+                             (annotation-spans-whole-line-p (and (= 
start-overlay bol)
+                                                                 (= 
end-overlay   eol))))
+                        (if annotation-spans-whole-line-p
+                            (progn
+                              (goto-char end-overlay)
+                              (push-mark start-overlay t t)
+                              (annotate-change-annotation (overlay-start 
annotation))
+                              (pop-mark))
+                          (annotate-overwrite-line bol eol)))
+                    (annotate-overwrite-line bol eol)))))
     (let ((annotation (annotate-annotation-at (point))))
       (cond
        ((use-region-p)
@@ -676,9 +682,11 @@ specified by `from' and `to'."
                 (save-excursion
                   (let* ((bol (annotate-beginning-of-line-pos))
                          (eol (point)))
-                    (if (/= eol bol)
+                    (if (/=  eol bol)       ; text before the newline, 
annotate it
                         (annotate-line eol)
-                      (progn
+                      (progn                ; no text before  the new
+                                            ; line, annotate next line
+                                            ; with proper text
                         (forward-line 1)
                         (goto-char (annotate-end-of-line-pos))
                         (annotate-annotate))))))))))))



reply via email to

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