[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ace-window 138a80c 83/92: ace-window.el (aw--lead-overl
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ace-window 138a80c 83/92: ace-window.el (aw--lead-overlay): Fix double recenter problem |
Date: |
Wed, 17 Mar 2021 18:39:27 -0400 (EDT) |
branch: externals/ace-window
commit 138a80cbc4e9ed17d3a085a3687f5223a142a9a3
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
ace-window.el (aw--lead-overlay): Fix double recenter problem
* ace-window.el (aw--done): Add logic for restoring old window points.
(aw--face-rel-height): Should return 1 for :height 1.0.
When the face height is e.g. 3, we do a recenter to make sure it's
visible. But that shifts the point out of window, which results in another
recenter.
After the second recenter the point is visible, but the overlay isn't.
Fixes #176
---
ace-window.el | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/ace-window.el b/ace-window.el
index 55d1ef7..9b61ff3 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -273,6 +273,10 @@ Modify them back eventually.")
"List of (window . hscroll-columns) items, each listing a window whose
horizontal scroll will be restored upon ace-window action completion.")
+(defvar aw--windows-points nil
+ "List of (window . point) items. The point position had to be
+ moved in order to display the overlay.")
+
(defun aw--done ()
"Clean up mode line and overlays."
;; mode line
@@ -286,8 +290,12 @@ Modify them back eventually.")
(when (string= (buffer-string) " ")
(let ((inhibit-read-only t))
(delete-region (point-min) (point-max))))))
+ (setq aw-empty-buffers-list nil)
(aw--restore-windows-hscroll)
- (setq aw-empty-buffers-list nil))
+ (let (c)
+ (while (setq c (pop aw--windows-points))
+ (with-selected-window (car c)
+ (goto-char (cdr c))))))
(defun aw--restore-windows-hscroll ()
"Restore horizontal scroll of windows from `aw--windows-hscroll' list."
@@ -363,8 +371,9 @@ LEAF is (PT . WND)."
(prev nil)
(vertical-pos (if (eq aw-char-position 'left) -1 0))
(horizontal-pos (if (zerop (window-hscroll)) 0 (1+
(window-hscroll))))
+ (old-pt (point))
(pt
- (save-excursion
+ (progn
;; 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.
@@ -381,6 +390,11 @@ LEAF is (PT . WND)."
(recenter vertical-pos)
(point)))
(ol (make-overlay pt (1+ pt) (window-buffer wnd))))
+ (if (= (aw--face-rel-height) 1)
+ (goto-char old-pt)
+ (when (/= pt old-pt)
+ (goto-char (+ pt 1))
+ (push (cons wnd old-pt) aw--windows-points)))
(overlay-put ol 'display (aw--overlay-str wnd pt path))
(overlay-put ol 'face 'aw-leading-char-face)
(overlay-put ol 'window wnd)
@@ -837,7 +851,7 @@ Modify `aw-fair-aspect-ratio' to tweak behavior."
((eq h 'unspecified)
1)
((floatp h)
- (1+ (floor h)))
+ (max (floor h) 1))
((integerp h)
1)
(t
- [elpa] externals/ace-window 26c0ad0 36/92: ace-window.el (aw-dispatch-default): Check action, (continued)
- [elpa] externals/ace-window 26c0ad0 36/92: ace-window.el (aw-dispatch-default): Check action, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 92d20e7 47/92: Bring back "Make window ordering rely on frame position", Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 6ff31d1 33/92: Do not ignore window-parameters, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window ceea53d 41/92: ace-window.el (aw-dispatch-default): Add fboundp, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window d5d8f5d 30/92: Update README.md with latest commands and remove "i" (duplicate), Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 5b88de0 49/92: ace-window.el (aw-translate-char-function): New defcustom, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window f0da12d 71/92: Readme.md: Add copy window to both action lists, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window edbbb1b 86/92: ace-window.el (ace-window): Extend doc, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 196382b 78/92: ace-window.el (aw-display-mode-overlay): New defcustom, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window cd82d83 77/92: Use call-interactively if the callee function is a command, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 138a80c 83/92: ace-window.el (aw--lead-overlay): Fix double recenter problem,
Stefan Monnier <=
- [elpa] externals/ace-window 7003c88 91/92: ace-window.el: Bump version, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window d93e16b 48/92: ace-window.el: Fix frame-parameter being a cons sometimes, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 2e3b956 53/92: ace-window.el (aw-ignored-p): Ignore child frames, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window a2f1dd5 61/92: ace-window.el (aw--face-rel-height): Fix for int height, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 88e48db 56/92: ace-window.el: Fix leading char not displayed if the face height isn't 1.0, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window c963bb9 79/92: ace-window.el: Fix compiler warning, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window b93380c 90/92: ace-window.el: Remove obsolete variables, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 702bc27 45/92: Show the overlay in the bottom of the window too, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 746ffd2 52/92: ace-window.el (aw-ignored-buffers): Clean up doc, Stefan Monnier, 2021/03/17
- [elpa] externals/ace-window 2307fd1 64/92: ace-window.el (aw-dispatch-alist): Don't bind anything on home row, Stefan Monnier, 2021/03/17