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

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

[nongnu] elpa/popon cbcfb8d978 03/15: Fix problem with buffer without fi


From: ELPA Syncer
Subject: [nongnu] elpa/popon cbcfb8d978 03/15: Fix problem with buffer without final newline
Date: Sun, 22 May 2022 12:59:18 -0400 (EDT)

branch: elpa/popon
commit cbcfb8d978ff0ed371366231df21fe388edb052f
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Fix problem with buffer without final newline
---
 popon.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/popon.el b/popon.el
index cf8b022b28..77bd61f0c0 100644
--- a/popon.el
+++ b/popon.el
@@ -287,11 +287,18 @@ when LINE-BEGINNINGS was calculated.")
       (dolist (block line-map)
         (let ((ov (make-overlay (caar block) (cdar block))))
           (push ov (window-parameter nil 'popon-overlays))
+          (overlay-put ov 'window (selected-window))
           (overlay-put ov 'display (if newline-at-display "\n" ""))
           (overlay-put
            ov 'before-string
            (let ((text "")
                  (current-offset 0))
+             (when (and (= (caar block) (cdar block) (point-max))
+                        (> (caar block) 0)
+                        (not (equal (buffer-substring-no-properties
+                                     (1- (caar block)) (caar block))
+                                    "\n")))
+               (setq text "\n"))
              (dolist (line (sort (cdr block) #'car-less-than-car))
                (setq text (concat text
                                   (make-string (- (car line)
@@ -301,7 +308,6 @@ when LINE-BEGINNINGS was calculated.")
                (setq current-offset (car line)))
              (add-face-text-property 0 (length text) 'default 'append text)
              (concat text (unless newline-at-display "\n"))))
-          (overlay-put ov 'window (selected-window))
           (setq newline-at-display (not newline-at-display)))))))
 
 (defun popon--redisplay-1 (force)



reply via email to

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