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

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

[nongnu] elpa/popon 88d2d3ca2a 09/15: Revert "Fix #1 newline background


From: ELPA Syncer
Subject: [nongnu] elpa/popon 88d2d3ca2a 09/15: Revert "Fix #1 newline background at end of line"
Date: Sun, 22 May 2022 12:59:18 -0400 (EDT)

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

    Revert "Fix #1 newline background at end of line"
    
    This reverts commit 95c1a57d0889c680a35b710e188fe356a5e2df1c.
    Because, this doesn't work with `visual-line-mode'.
---
 popon.el | 131 ++++++++++++++++++++++++---------------------------------------
 1 file changed, 50 insertions(+), 81 deletions(-)

diff --git a/popon.el b/popon.el
index 4382ca859d..87985ecc6e 100644
--- a/popon.el
+++ b/popon.el
@@ -43,51 +43,50 @@
   "Place LINES on top of FRAMEBUFFER.
 Place LINES on top of text at line X and column Y on FRAMEBUFFER and return
 FRAMEBUFFER.  LINES is a list of list as string.  FRAMEBUFFER is a list,
-each element is of form: (LINE MODIFIED EXTENDED OTHERS...), where LINE is
-as string, MODIFIED is t when LINE is modified and EXTENDED is t when the
-line has been extended.  OTHERS is not modified in any way.  Each line in
-LINES is assumed to occupy WIDTH character.  FRAMEBUFFER and LINES
-shouldn't contain newlines.  Example:
+each element is of form: (LINE MODIFIED OTHERS...), where LINE is the line
+as string and MODIFIED is t when LINE is modified.  OTHERS is not modified
+in any way.  Each line in LINES is assumed to occupy WIDTH character.
+FRAMEBUFFER and LINES shouldn't contain newlines.  Example:
 
 \(`popon--render-lines'
- '((\"GNU Emacs is “free software”; this means\" nil nil)
-   (\"that everyone is free to use it and free\" nil nil)
-   (\"to redistribute it under certain\"         nil nil)
-   (\"conditions.  GNU Emacs is not in the\"     nil nil)
-   (\"public domain; it is copyrighted and\"     nil nil)
-   (\"there are restrictions on its\"            nil nil)
-   (\"distribution, but these restrictions are\" nil nil)
-   (\"designed to permit everything that a\"     nil nil foo)
-   (\"good cooperating citizen would want to\"   nil nil bar)
-   (\"do.  What is not allowed is to try to\"    nil nil)
-   (\"prevent others from further sharing any\"  nil nil)
-   (\"version of GNU Emacs that they might get\" nil nil)
-   (\"from you.  The precise conditions are\"    nil nil)
-   (\"found in the GNU General Public License\"  nil nil)
-   (\"that comes with Emacs and also appears\"   nil nil)
-   (\"in this manual(1).  See Copying.\"         t nil))
+ '((\"GNU Emacs is “free software”; this means\" nil)
+   (\"that everyone is free to use it and free\" nil)
+   (\"to redistribute it under certain\"         nil)
+   (\"conditions.  GNU Emacs is not in the\"     nil)
+   (\"public domain; it is copyrighted and\"     nil)
+   (\"there are restrictions on its\"            nil)
+   (\"distribution, but these restrictions are\" nil)
+   (\"designed to permit everything that a\"     nil foo)
+   (\"good cooperating citizen would want to\"   nil bar baz)
+   (\"do.  What is not allowed is to try to\"    nil)
+   (\"prevent others from further sharing any\"  nil)
+   (\"version of GNU Emacs that they might get\" nil)
+   (\"from you.  The precise conditions are\"    nil)
+   (\"found in the GNU General Public License\"  nil)
+   (\"that comes with Emacs and also appears\"   nil)
+   (\"in this manual(1).  See Copying.\"         t))
  11 1 '(\"+--^^^^^^^^^^^^^-------------------------+\"
         \"|Free software is a type of software that|\"
         \"|respects user freedom.  Think free as in|\"
         \"|free speech, not as in free beer.       |\"
         \"+----------------------------------------+\")
  42)
-=> ((\"GNU Emacs is “free software”; this means\"              nil nil)
-    (\"that everyo+--^^^^^^^^^^^^^-------------------------+\" t t)
-    (\"to redistri|Free software is a type of software that|\" t t)
-    (\"conditions.|respects user freedom.  Think free as in|\" t t)
-    (\"public doma|free speech, not as in free beer.       |\" t t)
-    (\"there are r+----------------------------------------+\" t t)
-    (\"distribution, but these restrictions are\"              nil nil)
-    (\"designed to permit everything that a\"                  nil nil foo)
-    (\"good cooperating citizen would want to\"                nil nil bar)
-    (\"do.  What is not allowed is to try to\"                 nil nil)
-    (\"prevent others from further sharing any\"               nil nil)
-    (\"version of GNU Emacs that they might get\"              nil nil)
-    (\"from you.  The precise conditions are\"                 nil nil)
-    (\"found in the GNU General Public License\"               nil nil)
-    (\"that comes with Emacs and also appears\"                nil nil)
-    (\"in this manual(1).  See Copying.\"                      t nil))"
+=> ((\"GNU Emacs is “free software”; this means\"              nil)
+    (\"that everyo+--^^^^^^^^^^^^^-------------------------+\" t)
+    (\"to redistri|Free software is a type of software that|\" t)
+    (\"conditions.|respects user freedom.  Think free as in|\" t)
+    (\"public doma|free speech, not as in free beer.       |\" t)
+    (\"there are r+----------------------------------------+\" t)
+    (\"distribution, but these restrictions are\"              nil)
+    (\"designed to permit everything that a\"                  nil foo)
+    (\"good cooperating citizen would want to\"                nil bar baz)
+    (\"do.  What is not allowed is to try to\"                 nil)
+    (\"prevent others from further sharing any\"               nil)
+    (\"version of GNU Emacs that they might get\"              nil)
+    (\"from you.  The precise conditions are\"                 nil)
+    (\"found in the GNU General Public License\"               nil)
+    (\"that comes with Emacs and also appears\"                nil)
+    (\"in this manual(1).  See Copying.\"                      t))"
   (let ((tab-size tab-width))
     (with-temp-buffer
       (setq-local tab-width tab-size) ; Preseve tab width.
@@ -95,17 +94,14 @@ shouldn't contain newlines.  Example:
         (when (< (+ y i) (length framebuffer))
           (erase-buffer)
           (insert (car (nth (+ y i) framebuffer)))
-          (let ((end (point-max)))
-            (move-to-column x t)
-            (let ((mark (point)))
-              (move-to-column (+ x width) t)
-              (setf (car (nth (+ y i) framebuffer))
-                    (concat (buffer-substring (point-min) mark)
-                            (nth i lines)
-                            (buffer-substring (point) (point-max))))
-              (setf (cadr (nth (+ y i) framebuffer)) t)
-              (when (< end (point-max))
-                (setf (caddr (nth (+ y i) framebuffer)) t))))))
+          (move-to-column x t)
+          (let ((mark (point)))
+            (move-to-column (+ x width) t)
+            (setf (car (nth (+ y i) framebuffer))
+                  (concat (buffer-substring (point-min) mark)
+                          (nth i lines)
+                          (buffer-substring (point) (point-max))))
+            (setf (cadr (nth (+ y i) framebuffer)) t))))
       framebuffer)))
 
 ;;;###autoload
@@ -270,7 +266,7 @@ when LINE-BEGINNINGS was calculated.")
                   (disp-str (string-trim-right
                              (buffer-substring mark (point))
                              "\n")))
-              (push (list (string-trim-right disp-str) nil nil line mark
+              (push (list (string-trim-right disp-str) nil line mark
                           (if (equal str disp-str) (point) (1- (point))))
                     framebuffer)))
           (push (cons mark (point)) line-boundaries)
@@ -295,13 +291,12 @@ when LINE-BEGINNINGS was calculated.")
     (let ((i 0))
       (dolist (line framebuffer)
         (when (nth 1 line)
-          (let* ((key (cons (nth 4 line) (nth 5 line)))
+          (let* ((key (cons (nth 3 line) (nth 4 line)))
                  (pair (assoc key line-map)))
             (unless pair
-              (setq pair (list key nil nil))
+              (setq pair (cons key nil))
               (push pair line-map))
-            (setf (cadr pair) (or (cadr pair) (nth 2 line)))
-            (push (cons (- i (nth 3 line)) (car line)) (caddr pair))))
+            (push (cons (- i (nth 2 line)) (car line)) (cdr pair))))
         (setq i (1+ i))))
     (dolist (block line-map)
       (let ((ov (make-overlay (caar block) (cdar block))))
@@ -317,7 +312,7 @@ when LINE-BEGINNINGS was calculated.")
                                    (1- (caar block)) (caar block))
                                   "\n")))
              (setq text "\n"))
-           (dolist (line (sort (caddr block) #'car-less-than-car))
+           (dolist (line (sort (cdr block) #'car-less-than-car))
              (setq text (concat text
                                 (make-string (- (car line)
                                                 current-offset)
@@ -325,33 +320,7 @@ when LINE-BEGINNINGS was calculated.")
                                 (cdr line)))
              (setq current-offset (car line)))
            (add-face-text-property 0 (length text) 'default 'append text)
-           text)))
-      (when (and (cadr block)
-                 (< (cdar block) (point-max))
-                 (not (let* ((extend-attr
-                              (lambda (face)
-                                (if (facep face)
-                                    (face-attribute face :extend)
-                                  (if-let (val (plist-member face :extend))
-                                      (cadr val)
-                                    'unspecified))))
-                             (extend 'unspecified))
-                        (let ((faceprop (get-char-property (cdar block)
-                                                           'face)))
-                          (catch 'done
-                            (if (face-list-p faceprop)
-                                (dolist (face faceprop)
-                                  (setq extend (funcall extend-attr face))
-                                  (when (booleanp extend)
-                                    (throw 'done extend)))
-                              (setq extend (funcall extend-attr faceprop))
-                              (when (booleanp extend)
-                                (throw 'done extend)))
-                            (funcall extend-attr 'default))))))
-        (let ((ov (make-overlay (cdar block) (1+ (cdar block)))))
-          (push ov (window-parameter nil 'popon-overlays))
-          (overlay-put ov 'window (selected-window))
-          (overlay-put ov 'face 'default))))))
+           text))))))
 
 (defun popon--redisplay-1 (force)
   "Redisplay popon overlays.



reply via email to

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