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