This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
Account for "line-spacing" when calculating rows for side-window-right #333
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to Issue #205. After leaving a comment, I discovered that I could only recreate the problem if Emacs's line-spacing variable was set to a positive number.
The
line-spacing
variable adds space between lines, thereby reducing the number of lines in a frame. It can have a per-frame value, but that'll be overridden if the global line-spacing variable has been set, e.g. through the customize interface.It appears that the built-in
frame-height
function simply calculates a number of rows by dividing pixel height by the default character size. But it doesn't account for the additional space used byline-spacing
. In turn, this causes which-key's side-window-right configuration to overlap the modeline wheneverline-spacing
has been set to a positive value.For example, on my system:
(frame-char-height)
returns 17, and(frame-pixel-height)
returns 1080. Dividing 1080 by 17 and rounding downward would give a row count of 63, which is the number that(frame-height)
returns. If we subtract 2 for the modeline and echo area, we would expect to have 61 visible rows of text.I can confirm this with
line-spacing
set to nil. I turn onglobal-linum-mode
, and go to the top of a buffer and see 61 fully visible lines of text.But if I set
line-spacing
to 0.1,(frame-height)
still returns 63. Then if I go to the top of my buffer again, I can see that the number of visible rows was reduced to 58.This is just using the pixel based measurements to get a more accurate row count. It fixes the issue for me. And I'm certainly open to any feedback or discussion.
Not sure if it's needed for such a small contribution, but I went ahead and emailed the form in.
Been enjoying this package very much for a while now. Thank you and best regards!