Skip to content

Measure the header offset instead of counting the fringe - #5

Merged
Gleek merged 1 commit into
Gleek:mainfrom
demoj1:fix/header-left-offset
Sep 5, 2026
Merged

Gleek merged 1 commit into
Gleek:mainfrom
demoj1:fix/header-left-offset

Conversation

@demoj1

@demoj1 demoj1 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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-edges reports 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):

positions
all-day cell borders in the header 99, 234, 370, 506, 641, 777, 912
column lines in the grid 114, 250, 386, 522, 657, 793, 929

A constant +16 everywhere.

The fix measures the gap with window-edges instead 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:

positions
column centres 182, 318, 454, 589, 725, 861
day names 182, 318, 454, 589, 725, 861

after

Tests: 24 pass.

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
@Gleek
Gleek merged commit 08100bf into Gleek:main Sep 5, 2026
5 checks passed
@Gleek

Gleek commented Sep 5, 2026

Copy link
Copy Markdown
Owner

LGTM, Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants