Skip to content

[DO NOT MERGE] Hang trailing whitespace (conditionally for last line in paragraph)#3

Draft
conor-93 wants to merge 1 commit into
mainfrom
conor/upstream/withHangingWhitespaceFixes
Draft

[DO NOT MERGE] Hang trailing whitespace (conditionally for last line in paragraph)#3
conor-93 wants to merge 1 commit into
mainfrom
conor/upstream/withHangingWhitespaceFixes

Conversation

@conor-93
Copy link
Copy Markdown
Owner

No description provided.

@conor-93 conor-93 changed the title [NOT FOR MERGE] Hang trailing whitespace (conditionally for last line in paragraph) [DO NOT MERGE] Hang trailing whitespace (conditionally for last line in paragraph) May 14, 2026
Copy link
Copy Markdown

@djmcnab-canva djmcnab-canva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good. I definitely understand how this resolves.

One question: Did you evaluate using linebender#485 instead? In my reading, that looks like it solves the same issues with very similar approaches, but also handles the hanging clusters issue.

Comment on lines +107 to +111
// Hanging whitespace is an alignment/positioning concern, orthogonal to text
// directionality. The RTL handling here doesn't interact with bidi reordering:
// it simply shifts the line's origin so that hung trailing whitespace (which
// sits at the *start* edge in visual order for RTL) overflows into the start
// margin rather than displacing visible content.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This smells like a Claude artifact to me. I'd lean towards reverting this section.

Comment on lines +664 to +665
// TODO: can this be hoisted out of the conditional?
self.state.cluster_idx += 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly surprised that this actually gets all the remaining space clusters in the line; my impression was previously that the reason we were seeing the wrapping behaviour was because this is +1. That is, do we not need to consume clusters until we reach the last cluster on the line? We might need to do more digging

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't clear to me why this snapshot has been regenerated. Do you have that clear?

I can't see any actual changes, so I'm not overly worried.

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