[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popon e6e2e8dff0 10/15: Revert "Revert "Fix #1 newline bac
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popon e6e2e8dff0 10/15: Revert "Revert "Fix #1 newline background at end of line"" |
Date: |
Sun, 22 May 2022 12:59:19 -0400 (EDT) |
branch: elpa/popon
commit e6e2e8dff010166836fc7ad5d2863c315e29dd8d
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Revert "Revert "Fix #1 newline background at end of line""
This reverts commit 88d2d3ca2ac4f2ad53058559874f8ec2459d4fd9.
---
popon.el | 131 +++++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 81 insertions(+), 50 deletions(-)
diff --git a/popon.el b/popon.el
index 87985ecc6e..4382ca859d 100644
--- a/popon.el
+++ b/popon.el
@@ -43,50 +43,51 @@
"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 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:
+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:
\(`popon--render-lines'
- '((\"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))
+ '((\"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))
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)
- (\"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))"
+=> ((\"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))"
(let ((tab-size tab-width))
(with-temp-buffer
(setq-local tab-width tab-size) ; Preseve tab width.
@@ -94,14 +95,17 @@ FRAMEBUFFER and LINES shouldn't contain newlines. Example:
(when (< (+ y i) (length framebuffer))
(erase-buffer)
(insert (car (nth (+ y i) framebuffer)))
- (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))))
+ (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))))))
framebuffer)))
;;;###autoload
@@ -266,7 +270,7 @@ when LINE-BEGINNINGS was calculated.")
(disp-str (string-trim-right
(buffer-substring mark (point))
"\n")))
- (push (list (string-trim-right disp-str) nil line mark
+ (push (list (string-trim-right disp-str) nil nil line mark
(if (equal str disp-str) (point) (1- (point))))
framebuffer)))
(push (cons mark (point)) line-boundaries)
@@ -291,12 +295,13 @@ when LINE-BEGINNINGS was calculated.")
(let ((i 0))
(dolist (line framebuffer)
(when (nth 1 line)
- (let* ((key (cons (nth 3 line) (nth 4 line)))
+ (let* ((key (cons (nth 4 line) (nth 5 line)))
(pair (assoc key line-map)))
(unless pair
- (setq pair (cons key nil))
+ (setq pair (list key nil nil))
(push pair line-map))
- (push (cons (- i (nth 2 line)) (car line)) (cdr pair))))
+ (setf (cadr pair) (or (cadr pair) (nth 2 line)))
+ (push (cons (- i (nth 3 line)) (car line)) (caddr pair))))
(setq i (1+ i))))
(dolist (block line-map)
(let ((ov (make-overlay (caar block) (cdar block))))
@@ -312,7 +317,7 @@ when LINE-BEGINNINGS was calculated.")
(1- (caar block)) (caar block))
"\n")))
(setq text "\n"))
- (dolist (line (sort (cdr block) #'car-less-than-car))
+ (dolist (line (sort (caddr block) #'car-less-than-car))
(setq text (concat text
(make-string (- (car line)
current-offset)
@@ -320,7 +325,33 @@ when LINE-BEGINNINGS was calculated.")
(cdr line)))
(setq current-offset (car line)))
(add-face-text-property 0 (length text) 'default 'append text)
- 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))))))
(defun popon--redisplay-1 (force)
"Redisplay popon overlays.
- [nongnu] branch elpa/popon created (now aed8ff598d), ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon cbcfb8d978 03/15: Fix problem with buffer without final newline, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 6d7ee4f32b 07/15: Don't mess up line numbers, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 651b648420 06/15: Fix popon breaking on buffers without final newline, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 95c1a57d08 08/15: Fix #1 newline background at end of line, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 88d2d3ca2a 09/15: Revert "Fix #1 newline background at end of line", ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon e4d9123e0b 13/15: Fix popon beyond EOB appearing at wrong position, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 7e6a5d6ec6 02/15: Add COPYING, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 7a359994ff 05/15: Add autoload cookies, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 240fb286d8 01/15: Working implementation, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon e6e2e8dff0 10/15: Revert "Revert "Fix #1 newline background at end of line"",
ELPA Syncer <=
- [nongnu] elpa/popon aed8ff598d 15/15: Take the fringe width into account, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon c34dd56fbd 04/15: Add installation instruction, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 6c1311600a 11/15: Lower required Emacs version, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 22e76f812c 14/15: Fix Eshell popon error, ELPA Syncer, 2022/05/22
- [nongnu] elpa/popon 61b54bea8c 12/15: Fix popon breaking when long lines aren't truncated, ELPA Syncer, 2022/05/22