[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ace-window a429c66 72/92: ace-window.el (aw--lead-overl
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ace-window a429c66 72/92: ace-window.el (aw--lead-overlay): Handle windhow hscroll better |
Date: |
Wed, 17 Mar 2021 18:39:25 -0400 (EDT) |
branch: externals/ace-window
commit a429c66f318af0452a009f96b39a18f9b0fe232b
Author: Bob Weiner <rsw@gnu.org>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
ace-window.el (aw--lead-overlay): Handle windhow hscroll better
Fixes #165
Re #131
---
ace-window.el | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/ace-window.el b/ace-window.el
index e7c78b4..2753c19 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -315,36 +315,40 @@ accessible by typing PATH."
(defun aw--lead-overlay (path leaf)
"Create an overlay using PATH at LEAF.
LEAF is (PT . WND)."
+ ;; Properly adds overlay in visible region of most windows except for any one
+ ;; receiving output while this function is executing, since that moves point,
+ ;; potentially shifting the added overlay outside the window's visible
region.
(let ((wnd (cdr leaf)))
(with-selected-window wnd
(when (= 0 (buffer-size))
(push (current-buffer) aw-empty-buffers-list)
(let ((inhibit-read-only t))
(insert " ")))
-
- (let* ((pt (car leaf))
+ (let* ((prev)
+ (vertical-pos (if (eq aw-char-position 'left) -1 0))
+ (horizontal-pos (if (zerop (window-hscroll)) 0 (1+
(window-hscroll))))
+ (pt
+ (save-excursion
+ ;; If leading-char is to be displayed at the top-left, move
+ ;; to the first visible line in the window, otherwise, move
+ ;; to the last visible line.
+ (move-to-window-line vertical-pos)
+ (move-to-column horizontal-pos)
+ ;; Find a nearby point that is not at the end-of-line but
+ ;; is visible so have space for the overlay.
+ (setq prev (1- (point)))
+ (while (and (/= prev (point)) (eolp))
+ (setq prev (point))
+ (unless (bobp)
+ (line-move -1 nil)
+ (move-to-column horizontal-pos)))
+ (recenter vertical-pos)
+ (point)))
(ol (make-overlay pt (1+ pt) (window-buffer wnd))))
(overlay-put ol 'display (aw--overlay-str wnd pt path))
(overlay-put ol 'face 'aw-leading-char-face)
(overlay-put ol 'window wnd)
- (push ol avy--overlays-lead))
-
- (when (eq aw-char-position 'left)
- (let* ((pt
- (save-excursion
- ;; Move to the start of the last visible line in the buffer.
- (move-to-window-line -1)
- (move-beginning-of-line nil)
- ;; If this line is empty, use the previous line so we
- ;; have space for the overlay.
- (when (equal (point) (point-max))
- (forward-line -1))
- (point)))
- (ol (make-overlay pt (1+ pt) (window-buffer wnd))))
- (overlay-put ol 'display (aw--overlay-str wnd pt path))
- (overlay-put ol 'face 'aw-leading-char-face)
- (overlay-put ol 'window wnd)
- (push ol avy--overlays-lead))))))
+ (push ol avy--overlays-lead)))))
(defun aw--make-backgrounds (wnd-list)
"Create a dim background overlay for each window on WND-LIST."
- [elpa] externals/ace-window 188c07a 26/92: Add aw--switch-buffer with ivy and ido, (continued)
- [elpa] externals/ace-window 188c07a 26/92: Add aw--switch-buffer with ivy and ido, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 94986cb 65/92: ace-window.el (aw-ignored-p): Don't ignore window if it's selected, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 2d132ba 75/92: ace-window.el (aw-transpose-frame): Add and bind to "t", Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window a534492 85/92: ace-window.el (aw-minibuffer-leading-char-face): New face, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 15b0639 34/92: ace-window.el (aw-make-frame-char): New defcustom, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window d4066b1 44/92: Revert "Make window ordering rely on frame position", Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 3fe86fb 51/92: Update the name of the LV buffer, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window bd48027 54/92: ace-window.el (aw-ignored-p): Only call frame-parent if defined, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 21fb8ab 58/92: ace-window.el (aw--after-make-frame): Extract, add make-frame-visible, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window d7bdb53 70/92: Make aw-make-frame disable-able, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window a429c66 72/92: ace-window.el (aw--lead-overlay): Handle windhow hscroll better,
Stefan Monnier <=
- [elpa] externals/ace-window ac89475 73/92: Fix handling of horizontally scrolled windows and buffer-begin error, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window a3ad48f 74/92: ace-window.el (aw--point-visible-p): Prettify doc, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 091150b 84/92: .github/FUNDING.yml: Add, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 301c762 76/92: ace-window.el (aw-transpose-frame): Move to "T" binding, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window a36c147 88/92: ace-window.el (aw-dispatch-alist): Add hyperbole comment, Stefan Monnier, 2021/03/17