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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text Reflowing/Justification (2) #236
Text Reflowing/Justification (2) #236
Changes from 12 commits
9a2c378
a4c741e
ebe7df5
6844310
5f87832
d423570
6ab4430
d142ff1
e0e9f79
a31ee71
a46f8dd
677250b
c6c0f85
9f22d48
fdec763
1716739
6adf8c2
cc80df3
c565673
04fae79
2adc1ee
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should do all of this for you! ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi - looks like I pushed this without testing and for some reason reading the resulting range (specifically on a one-line file, though maybe in more scenarios) from the selection with
.read
returns an error. I've just reverted that for now, but I can try to see what's going on with that later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the method implementation is clever, but hard to read/understand.
I put together a Rust playground example of an implementation that uses
fold
to carry the length accumulator. It also avoids pre-building space delimiters, opting instead to use them literally where they're needed.It's possible I've missed an edge case, but I think leaning into that kind of an approach is easier to follow, and would help with long-term maintainability. 😇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The playground example you gave seems to have a few issues:
I personally feel that once that's fixed, we'd end up with something about the same length and nearly as complex as what's currently in the fork. I completely agree with you about the complexity, but imo reflowing is non-trivial to implement trivially --- it might just be more efficient to leave it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough! I can always refactor against the test suite afterwards. 👍🏼