Measure the header offset instead of counting the fringe - #5
Merged
Merged
Conversation
You were right about the scroll bar. The header line starts at the left edge of the window. The tiles are text, so they start after everything that sits on the left: the fringe, the margin, and the scroll bar when it is on the left side. The header only added the fringe, so it was drawn that much to the left of the grid. On my window the gap is 24px: an 8px fringe and a 16px scroll bar. With a Lucid build the vertical scroll bar is on the left, so the header was off by 16px. The step of the columns was already right, so the whole header was simply shifted, not stretched. Measure the gap with `window-edges' instead. It covers the fringe, the margin and the scroll bar at once, whichever side they are on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014nqM3DEZjQyybPRfBMwypu
Owner
|
LGTM, Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 the leftover misalignment you spotted in #2. You guessed it right: it is the scroll bar.
The header line starts at the left edge of the window. The tiles are text, so they start after everything on the left: the fringe, the margin, and the scroll bar when it sits on the left. The header code only added the fringe, so it was drawn to the left of the grid by the width of the rest.
On my window
window-edgesreports a 24px gap: an 8px fringe and a 16px scroll bar. I build Emacs with the Lucid toolkit, where the vertical scroll bar is on the left, so the header was off by 16px. The column step was already correct, so the header was shifted as a whole, not stretched — which is why it looked like a small constant error rather than a growing one.Measured on the screenshot from #2 (
emacs -Q, empty backend):all-daycell borders in the headerA constant +16 everywhere.
The fix measures the gap with
window-edgesinstead of counting the fringe. That covers the fringe, the margin and the scroll bar at once, on either side. After it the day names sit exactly on the column centres:Tests: 24 pass.