Fix empty-file placeholder clipping to one line after view rebuild#69
Merged
Conversation
With an empty document the ghost-quote placeholder clipped to one or two lines after the editor was rebuilt — e.g. switching to a graph/timeline view and back. Root cause: the placeholder is a subview of the text view, so it's clipped to the text view's frame height. An empty doc's text view should fill the viewport (max(content, viewport)), but the viewport-fill pass can run while the scroll view still has height 0 (pre-window layout on rebuild), leaving the text view at its one-line content height — and the container's restack never re-measures it. So the text view stayed ~one line tall and clipped the multi-line quote. Fix: when the placeholder is visible, re-run applyManagedFrameSize from setPlaceholder (called every updateNSView) so the text view picks up the now-valid viewport height and stops clipping. No-op once already sized; only runs while the placeholder is shown, so non-empty docs are untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a1a1277 to
597678d
Compare
luca-chen198
added a commit
that referenced
this pull request
Jun 20, 2026
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.
Problem
With an empty document, the ghost-quote placeholder (
PlaceholderLabelView) clipped to one line after the editor was rebuilt — e.g. switching to a graph/timeline view and back.Cause
The placeholder draws with
attributedText.draw(with: bounds, …), so its drawable height is the view's frame height, andplaceholderFrame()derives that from the text view's frame height. For an empty document the text view sits at the one-line content height until the viewport-fill pass (applyManagedFrameSize) stretches it — and the container'srestackdeliberately never re-measures it. There is nolayout()hook re-applyingplaceholderFrame(), so after a rebuild the placeholder gets stuck at one line and clips the multi-line quote.Fix
Size the placeholder to the quote's own wrapped height, measured at the column width, instead of borrowing the text view's frame height:
The normal (viewport-tall) case is unchanged because the frame height still wins the
max; only the collapsed empty-doc case is corrected.Test
swift build+swift testgreen (90 tests). Verified in the embedder (Nodes): empty file → graph view → back now shows the full quote.🤖 Generated with Claude Code