Skip to content

Exclude editor bottom padding from split scroll sync - #316

Merged
PathGao merged 3 commits into
sftwrdotdev:masterfrom
PathGao:fix/exclude-editor-bottom-padding-from-scroll-sync
Aug 2, 2026
Merged

Exclude editor bottom padding from split scroll sync#316
PathGao merged 3 commits into
sftwrdotdev:masterfrom
PathGao:fix/exclude-editor-bottom-padding-from-scroll-sync

Conversation

@PathGao

@PathGao PathGao commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Fixes #315

Monaco keeps blank space below the final line because scrollBeyondLastLine is enabled. The previous synchronization range used scroll height, so that non-content space made the editor’s final document line map to a preview position above its end.

Uses Monaco content height for both directions of split-scroll synchronization while retaining the editor’s scroll-beyond-last-line preference and front-matter segmentation.

Adds a regression assertion that synchronization does not use the padded scroll range.

This is stacked after #314 and its predecessors. Merge the predecessor chain first.

Validated with npm run check (0 errors, 0 warnings), npm test (136 passing), npm run build, and cargo test (21 passing).

@PathGao

PathGao commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

@alecdotdev This is the follow-up for the remaining end-of-document drift reported in #205. It keeps Monaco’s normal bottom-padding preference but removes that padding from the sync calculation. It is stacked after #314 and the predecessors; please review in order.

@PathGao
PathGao force-pushed the fix/exclude-editor-bottom-padding-from-scroll-sync branch from d15b4fa to 7a11594 Compare August 2, 2026 03:57
@PathGao
PathGao force-pushed the fix/exclude-editor-bottom-padding-from-scroll-sync branch from 7a11594 to 6b0d3b9 Compare August 2, 2026 04:11
@PathGao
PathGao merged commit a9f7b59 into sftwrdotdev:master Aug 2, 2026
5 checks passed
@PathGao
PathGao deleted the fix/exclude-editor-bottom-padding-from-scroll-sync branch August 2, 2026 06:32
PathGao added a commit that referenced this pull request Aug 2, 2026
Four already-fixed behaviours each left a copy behind, and every copy
looks like a reusable shared implementation:

- `markdown.ts::renderRichContent` (141 lines, exported, zero importers)
  lacks `rememberDiagramSource`, so anything that "switched to the
  shared version" would silently disable the light-theme Mermaid
  re-render that PDF and HTML export depend on. It also hand-rolls the
  theme choice instead of `resolveMermaidTheme` and carries an inline
  DOMPurify config instead of the shared contract.
- `markdown.ts::getLanguage` and `::highlightColorMap` duplicate the
  live copies in the viewer.
- `Editor.svelte::getEditorScrollMax` is the pre-#316 version, using
  `getScrollHeight()` where the live one uses `getContentHeight()`.

They were invisible because the tests guarding those behaviours each
read one hard-coded path. `scripts/singleImplementationConvention.test.ts`
generalises the allowlist idea to the whole `src` tree: one row per
fixed behaviour, scanned everywhere, plus a meta-test asserting every
rule still matches something so a rename cannot turn a rule into a
no-op.

Also fixes a `$effect` cleanup in Toc.svelte that removed its listener
from the current value of a prop rather than the node it attached to.

Co-authored-by: PathGao <gaoyanbo@gaoyanbodeMacBook-Air.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

Exclude Monaco bottom padding from split-scroll synchronization

1 participant