diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-12 07:17:29 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-12 07:17:29 -0500 |
| commit | b7c6b2c59a2ad74e8e886471ea57b2e87f812d4a (patch) | |
| tree | 5bd5f927bee7c42887c9317b014ba603e1e4c06a /tests/test-coverage-core--intersect.el | |
| parent | 2ec5acd31f480064036a4567d1af5592b2d52666 (diff) | |
| download | dotemacs-b7c6b2c59a2ad74e8e886471ea57b2e87f812d4a.tar.gz dotemacs-b7c6b2c59a2ad74e8e886471ea57b2e87f812d4a.zip | |
fix(nov): center the EPUB text by setting window margins directly
The 80% width from `4d9a206' wasn't actually narrowing the page: `cj/nov-apply-preferences' set `nov-text-width' to t (nov renders the text unfilled, one long line per paragraph) and counted on `visual-fill-column-mode' to set the window's display margins, but those margins never got applied in nov-mode buffers (even after manually re-running the layout), so the text wrapped at the full window width. The cause is still unknown.
This drops `visual-fill-column' from nov entirely:
- `nov-text-width' is a column count (~80% of the window's natural width), so nov's `shr' fills the text itself.
- `cj/nov-update-layout' sets the window's left/right margins directly to `(natural - text-width) / 2' each, centering the block, and pushes the fringes out to the window edge so they don't show as thin lines beside the text. When the width changes it re-renders, restoring the reading position approximately.
- `cj/nov-apply-preferences' adds a `kill-buffer-hook' that drops the margins and fringes when the EPUB buffer goes away, so a later buffer in that window isn't left indented.
- `+'/`=' and `-'/`_' adjust `cj/nov-margin-percent' and re-flow + re-center.
The text-width math moved into a `cj/nov--natural-window-width' helper alongside the existing `cj/nov--text-width'. Known nit: the centering is a touch left-of-center because shr wraps at word boundaries, so the rendered text is a bit narrower than `nov-text-width' and the right margin ends up slightly larger. Logged as a follow-up.
Diffstat (limited to 'tests/test-coverage-core--intersect.el')
0 files changed, 0 insertions, 0 deletions
