[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/corfu-popup 4ce83ab8bd 19/26: Fix #3: Keep popon within th
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/corfu-popup 4ce83ab8bd 19/26: Fix #3: Keep popon within the visible part of window |
Date: |
Sun, 22 May 2022 12:58:16 -0400 (EDT) |
branch: elpa/corfu-popup
commit 4ce83ab8bdd67f11f43d3b27e8b255ecd00f6853
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Fix #3: Keep popon within the visible part of window
---
corfu-popup.el | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/corfu-popup.el b/corfu-popup.el
index 43983dbe81..703dad8f96 100644
--- a/corfu-popup.el
+++ b/corfu-popup.el
@@ -106,17 +106,33 @@ Show a vertical scroll bar of size BAR + 1 from LOth
line."
`(space
:width (,margin-right-width)))
(make-string margin-right-width ? ))))
+ (popon-width (if (display-graphic-p)
+ (+ width (round (/ (+ margin-left-width
+ margin-right-width)
+ (frame-char-width))))
+ (+ width margin-left-width margin-right-width)))
(popon-pos (if (equal (cdr corfu-popup--last-position)
(list pos (window-start)
(buffer-modified-tick)))
(car corfu-popup--last-position)
(let ((pos (popon-x-y-at-pos pos)))
- (cons (max 0 (- (car pos) off))
- (if (and (< (floor (window-screen-lines))
- (+ (cdr pos) (length lines)))
- (>= (cdr pos) (length lines)))
- (- (cdr pos) (length lines))
- (1+ (cdr pos))))))))
+ (cons
+ (max
+ (min (- (car pos) off)
+ (- (window-width)
+ (line-number-display-width)
+ (if (display-graphic-p)
+ (let ((fringes (window-fringes)))
+ (/ (+ (car fringes) (cadr fringes))
+ (frame-char-width)))
+ (1+ (if (zerop (window-hscroll)) 0 1)))
+ popon-width))
+ 0)
+ (if (and (< (floor (window-screen-lines))
+ (+ (cdr pos) (length lines)))
+ (>= (cdr pos) (length lines)))
+ (- (cdr pos) (length lines))
+ (1+ (cdr pos))))))))
(setq corfu-popup--last-position
(list popon-pos pos (window-start) (buffer-modified-tick)))
(setq corfu-popup--popon
@@ -139,10 +155,7 @@ Show a vertical scroll bar of size BAR + 1 from LOth line."
str))
lines)
"\n")
- (if (display-graphic-p)
- (+ width (round (/ (+ margin-left-width margin-right-width)
- (frame-char-width))))
- (+ width margin-left-width margin-right-width)))
+ popon-width)
popon-pos))
nil))
- [nongnu] elpa/corfu-popup 0b2fd81ac0 17/26: Remove obsolete use of define-minor-mode, (continued)
- [nongnu] elpa/corfu-popup 0b2fd81ac0 17/26: Remove obsolete use of define-minor-mode, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup 3a8e98a982 21/26: Rename corfu-popup to corfu-terminal, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup 59730db33b 23/26: Don't ship images in packages, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup 323a92088c 20/26: Fix popon breaking when right fringe is zero on graphical display (#3), ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup fcb35a8c45 24/26: Add user option to disable on GUI, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup 2b4a7d7d16 18/26: Remove hardcoded popon height, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup eb4106aa5a 22/26: Add corfu-popup.el for backward compatibility, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup aaaaea5932 25/26: Use new integration strategy, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup 359e2e9849 26/26: Remove unused macro, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup fabfd00ff8 15/26: Update README as kind-icon no longer causes problem, ELPA Syncer, 2022/05/22
- [nongnu] elpa/corfu-popup 4ce83ab8bd 19/26: Fix #3: Keep popon within the visible part of window,
ELPA Syncer <=