[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 88efff5 010/184: Not to insert newlines.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 88efff5 010/184: Not to insert newlines. |
Date: |
Wed, 6 Oct 2021 00:00:57 -0400 (EDT) |
branch: elpa/popup
commit 88efff5098f333dfe6d9ea7191afefbf3265bb6f
Author: Tomohiro Matsuyama <tomo@cx4a.org>
Commit: Tomohiro Matsuyama <tomo@cx4a.org>
Not to insert newlines.
---
popup.el | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/popup.el b/popup.el
index 8a50293..fbf1bee 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 newlines
+ cursor offset scroll-top current-height list padding
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 (concat (substring content 1))))
+ content (substring content 1)))
(overlay-put overlay
'after-string
(concat prefix
@@ -523,13 +523,15 @@ 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))
- (newlines (max 0 (+ (- height (count-lines point (point-max))) (if
around 1 0))))
+ padding
current-column)
- ;; Case: no newlines at the end of the buffer
- (when (> newlines 0)
+ ;; Case: no room to put overlays
+ (when (eobp)
(popup-save-buffer-state
- (goto-char (point-max))
- (insert (make-string newlines ?\n))))
+ (let ((begin (point)))
+ (insert " ")
+ (setq padding (make-overlay begin (point)))
+ (overlay-put padding 'evaporate t))))
;; Case: the popup overflows
(if overflow
@@ -554,11 +556,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 (dangle t) (prefix "") (postfix ""))
+ (let (overlay begin w bottom (dangle t) (prefix "") (postfix ""))
(when around
- (popup-vertical-motion column direction))
- (setq around t
- current-column (popup-current-physical-column))
+ (setq bottom (zerop (popup-vertical-motion column direction))))
+ (setq around t)
+ (setq current-column (if bottom 0 (popup-current-physical-column)))
(when (> current-column column)
(backward-char)
@@ -566,7 +568,8 @@ 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 (= current-column 0)
+ (+ (if (and (not bottom)
+ (= current-column 0))
(- window-hscroll (current-column))
0)
(- column current-column))
@@ -574,6 +577,8 @@ 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)))
@@ -581,6 +586,7 @@ 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)
@@ -615,7 +621,7 @@ KEYMAP is a keymap that will be put on the popup contents."
:scroll-top 0
:current-height 0
:list nil
- :newlines newlines
+ :padding padding
:overlays overlays
:keymap keymap)))
(push it popup-instances)
@@ -628,14 +634,10 @@ 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))
- ;; Restore newlines state
- (let ((newlines (popup-newlines popup)))
- (when (> newlines 0)
+ (let ((padding (popup-padding popup)))
+ (when (overlayp padding)
(popup-save-buffer-state
- (goto-char (point-max))
- (dotimes (i newlines)
- (if (= (char-before) ?\n)
- (delete-char -1)))))))
+ (delete-region (overlay-start padding) (overlay-end padding))))))
nil)
(defun popup-draw (popup)
- [nongnu] elpa/popup 34be113 116/184: Merge pull request #78 from aki2o/fix-popup-delete, (continued)
- [nongnu] elpa/popup 34be113 116/184: Merge pull request #78 from aki2o/fix-popup-delete, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup dcc9ee5 119/184: Merge pull request #80 from ancane/master, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 0bead7c 086/184: Use cl-lib functions instead of cl in tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 29c6db4 130/184: Pass filtering function as an argument to popup-menu*, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 5374e55 110/184: Merge pull request #73 from auto-complete/add-initial-index-test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 47008e1 135/184: Allow the user to specify a custom function to build the regexp in isearch, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 3d62f15 161/184: Merge pull request #112 from PuercoWork/patch-1, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup cf2cefe 166/184: Fixed compile warning, free variable from display line numbers., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 51f4430 171/184: Fixed to not use emacs 26.1 as dep., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 28762fc 138/184: Improve definition, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 88efff5 010/184: Not to insert newlines.,
ELPA Syncer <=
- [nongnu] elpa/popup bb4bb26 019/184: git mv popup-test.el tests/popup-interactive-test.el, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 07901c6 023/184: Merge pull request #15 from tkf/travis-ci, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 31779da 028/184: Fix test case bug when batch mode., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4a31175 033/184: Split setup macro to support extra setup, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 52059d6 055/184: Merge pull request #24 from tkf/summary-overflow, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup d655fd2 057/184: Merge pull request #25 from tkf/truncated-summary, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a33775f 047/184: Add test case:popup-menu*, popup-cascade-menu, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 6f00052 072/184: Introduce version number, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 5a892e5 063/184: Do not use summary-face for selected item, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup d1dd7c4 124/184: Merge pull request #81 from auto-complete/fix-readme-about-installation, ELPA Syncer, 2021/10/06