Skip to content

Commit b0e2fa3

Browse files
authored
Fixes #1322: take tab-line height into account (#1323)
1 parent b237462 commit b0e2fa3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

evil-common.el

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -914,13 +914,14 @@ older Emacsen."
914914
(defun evil-posn-x-y (position)
915915
"Return the x and y coordinates in POSITION.
916916
This function returns y offset from the top of the buffer area including
917-
the header line.
917+
the header line and the tab line (on Emacs 27 and later versions).
918918

919919
On Emacs 24 and later versions, the y-offset returned by
920920
`posn-at-point' is relative to the text area excluding the header
921-
line, while y offset taken by `posn-at-x-y' is relative to the buffer
922-
area including the header line. This asymmetry is by design according
923-
to GNU Emacs team. This function fixes the asymmetry between them.
921+
line and the tab line, while y offset taken by `posn-at-x-y' is relative to
922+
the buffer area including the header line and the tab line.
923+
This asymmetry is by design according to GNU Emacs team.
924+
This function fixes the asymmetry between them.
924925

925926
Learned from mozc.el."
926927
(let ((xy (posn-x-y position)))
@@ -930,6 +931,8 @@ Learned from mozc.el."
930931
(window-header-line-height))
931932
evil-cached-header-line-height
932933
(setq evil-cached-header-line-height (evil-header-line-height))))))
934+
(when (fboundp 'window-tab-line-height)
935+
(setcdr xy (+ (cdr xy) (window-tab-line-height))))
933936
xy))
934937

935938
(defun evil-count-lines (beg end)

0 commit comments

Comments
 (0)