ace-window.el: Fix leading char not displayed if the face height isn't 1.0

Fixes #145
old-master
Oleh Krehel 7 years ago
parent 1b1950e15c
commit 88e48db56a
  1. 15
      ace-window.el

@ -751,6 +751,16 @@ Modify `aw-fair-aspect-ratio' to tweak behavior."
(aw--switch-buffer) (aw--switch-buffer)
(aw-flip-window)) (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) (defun aw-offset (window)
"Return point in WINDOW that's closest to top left corner. "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." 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)) (beg (window-start window))
(end (window-end window)) (end (window-end window))
(inhibit-field-text-motion t)) (inhibit-field-text-motion t))
(with-current-buffer (with-current-buffer (window-buffer window)
(window-buffer window)
(save-excursion (save-excursion
(goto-char beg) (goto-char beg)
(when (member major-mode '(shell-mode))
(forward-line (- (aw--face-rel-height) 1)))
(while (and (< (point) end) (while (and (< (point) end)
(< (- (line-end-position) (< (- (line-end-position)
(line-beginning-position)) (line-beginning-position))

Loading…
Cancel
Save