branch: externals/ace-window
commit 88e48db56a176363121058b15b965324dc8e92c9
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ace-window.el: Fix leading char not displayed if the face height isn't 1.0
Fixes #145
---
ace-window.el | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/ace-window.el b/ace-window.el
index 3ba0cb8..c0fedfc 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -751,6 +751,16 @@ Modify `aw-fair-aspect-ratio' to tweak behavior."
(aw--switch-buffer)
(aw-flip-window))
+(defun aw--face-rel-height ()
+ (let ((h (face-attribute 'aw-leading-char-face :height)))
+ (cond
+ ((eq h 'unspecified)
+ 1)
+ ((floatp h)
+ (1+ (floor h)))
+ (t
+ (error "unexpected: %s" h)))))
+
(defun aw-offset (window)
"Return point in WINDOW that's closest to top left corner.
The point is writable, i.e. it's not part of space after newline."
@@ -758,10 +768,11 @@ The point is writable, i.e. it's not part of space after
newline."
(beg (window-start window))
(end (window-end window))
(inhibit-field-text-motion t))
- (with-current-buffer
- (window-buffer window)
+ (with-current-buffer (window-buffer window)
(save-excursion
(goto-char beg)
+ (when (member major-mode '(shell-mode))
+ (forward-line (- (aw--face-rel-height) 1)))
(while (and (< (point) end)
(< (- (line-end-position)
(line-beginning-position))