[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup da210f5 012/184: Revert "Not to insert newlines."
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup da210f5 012/184: Revert "Not to insert newlines." |
Date: |
Wed, 6 Oct 2021 00:00:57 -0400 (EDT) |
branch: elpa/popup
commit da210f54beb175863081fdfa8e05097ef7438991
Author: Tomohiro Matsuyama <tomo@cx4a.org>
Commit: Tomohiro Matsuyama <tomo@cx4a.org>
Revert "Not to insert newlines."
This reverts commit 88efff5098f333dfe6d9ea7191afefbf3265bb6f.
---
popup.el | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/popup.el b/popup.el
index 1a0db18..8062cfd 100644
--- a/popup.el
+++ b/popup.el
@@ -239,7 +239,7 @@ buffer."
parent depth
face mouse-face selection-face
margin-left margin-right margin-left-cancel scroll-bar symbol
- cursor offset scroll-top current-height list padding
+ cursor offset scroll-top current-height list newlines
pattern original-list)
(defun popup-item-propertize (item &rest properties)
@@ -393,7 +393,7 @@ usual."
(unless (overlay-get overlay 'dangle)
(overlay-put overlay 'display (concat prefix (substring content 0 1)))
(setq prefix nil
- content (substring content 1)))
+ content (concat (substring content 1))))
(overlay-put overlay
'after-string
(concat prefix
@@ -523,15 +523,13 @@ KEYMAP is a keymap that will be put on the popup
contents."
;; Calculate direction
(popup-calculate-direction height row)))
(depth (if parent (1+ (popup-depth parent)) 0))
- padding
+ (newlines (max 0 (+ (- height (count-lines point (point-max))) (if
around 1 0))))
current-column)
- ;; Case: no room to put overlays
- (when (eobp)
+ ;; Case: no newlines at the end of the buffer
+ (when (> newlines 0)
(popup-save-buffer-state
- (let ((begin (point)))
- (insert " ")
- (setq padding (make-overlay begin (point)))
- (overlay-put padding 'evaporate t))))
+ (goto-char (point-max))
+ (insert (make-string newlines ?\n))))
;; Case: the popup overflows
(if overflow
@@ -556,11 +554,11 @@ KEYMAP is a keymap that will be put on the popup
contents."
(setq margin-left-cancel t))
(dotimes (i height)
- (let (overlay begin w bottom (dangle t) (prefix "") (postfix ""))
+ (let (overlay begin w (dangle t) (prefix "") (postfix ""))
(when around
- (setq bottom (zerop (popup-vertical-motion column direction))))
- (setq around t)
- (setq current-column (if bottom 0 (popup-current-physical-column)))
+ (popup-vertical-motion column direction))
+ (setq around t
+ current-column (popup-current-physical-column))
(when (> current-column column)
(backward-char)
@@ -568,8 +566,7 @@ KEYMAP is a keymap that will be put on the popup contents."
(when (< current-column column)
;; Extend short buffer lines by popup prefix (line of spaces)
(setq prefix (make-string
- (+ (if (and (not bottom)
- (= current-column 0))
+ (+ (if (= current-column 0)
(- window-hscroll (current-column))
0)
(- column current-column))
@@ -577,8 +574,6 @@ KEYMAP is a keymap that will be put on the popup contents."
(setq begin (point))
(setq w (+ popup-width (length prefix)))
- (when bottom
- (setq prefix (concat "\n" prefix)))
(while (and (not (eolp)) (> w 0))
(setq dangle nil)
(decf w (char-width (char-after)))
@@ -586,7 +581,6 @@ KEYMAP is a keymap that will be put on the popup contents."
(if (< w 0)
(setq postfix (make-string (- w) ? )))
-
(setq overlay (make-overlay begin (point)))
(overlay-put overlay 'window window)
(overlay-put overlay 'dangle dangle)
@@ -621,7 +615,7 @@ KEYMAP is a keymap that will be put on the popup contents."
:scroll-top 0
:current-height 0
:list nil
- :padding padding
+ :newlines newlines
:overlays overlays
:keymap keymap)))
(push it popup-instances)
@@ -634,10 +628,14 @@ KEYMAP is a keymap that will be put on the popup
contents."
(mapc 'delete-overlay (popup-overlays popup))
(setf (popup-overlays popup) nil)
(setq popup-instances (delq popup popup-instances))
- (let ((padding (popup-padding popup)))
- (when (overlayp padding)
+ ;; Restore newlines state
+ (let ((newlines (popup-newlines popup)))
+ (when (> newlines 0)
(popup-save-buffer-state
- (delete-region (overlay-start padding) (overlay-end padding))))))
+ (goto-char (point-max))
+ (dotimes (i newlines)
+ (if (= (char-before) ?\n)
+ (delete-char -1)))))))
nil)
(defun popup-draw (popup)
- [nongnu] elpa/popup dbf62bf 131/184: readme updated, (continued)
- [nongnu] elpa/popup dbf62bf 131/184: readme updated, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 004d58c 144/184: Merge pull request #97 from markus1189/eldoc, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 72c4028 151/184: extend overriding of background face for isearch, selection, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4839797 158/184: Looking for new maintainer, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 46e6104 162/184: Fixed some checkdoc warnings., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup ba90de4 004/184: Added documentation., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a6f582c 114/184: Merge pull request #76 from ramnes/master, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 55f3183 165/184: Bump version., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 0778cad 163/184: Bump version., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 3eeceea 009/184: v0.5 bump., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup da210f5 012/184: Revert "Not to insert newlines.",
ELPA Syncer <=
- [nongnu] elpa/popup b90c179 016/184: Update README.md, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 68b71de 142/184: Merge pull request #96 from auto-complete/improve, ELPA Syncer, 2021/10/06