Skip to content

Fix rdpq paragraph nbytes issue 702#847

Merged
rasky merged 7 commits intoDragonMinded:previewfrom
genecro:fix/rdpq_paragraph_nbytes702
Apr 11, 2026
Merged

Fix rdpq paragraph nbytes issue 702#847
rasky merged 7 commits intoDragonMinded:previewfrom
genecro:fix/rdpq_paragraph_nbytes702

Conversation

@genecro
Copy link
Copy Markdown

@genecro genecro commented Mar 25, 2026

This PR adds two pointers to the builder struct in rdpq_paragraph.c for keeping track of the last character that fit in the rectangular area as well as the last space that fit (for when WRAP_WORD is enabled).

@genecro genecro force-pushed the fix/rdpq_paragraph_nbytes702 branch from b030e92 to 0f5cff2 Compare March 25, 2026 22:36
@rasky
Copy link
Copy Markdown
Collaborator

rasky commented Mar 26, 2026

Can you please add a test for this behavior?

@genecro
Copy link
Copy Markdown
Author

genecro commented Mar 28, 2026

I missed the case where the first word doesn't fit in the width of the layout area and an ellipsis is added. I just pushed a fix for that. Now I am working on adding tests, will update again when complete.

@genecro
Copy link
Copy Markdown
Author

genecro commented Mar 28, 2026

Tests have been added

@genecro
Copy link
Copy Markdown
Author

genecro commented Mar 30, 2026

I implemented the changes we talked about in discord (https://discord.com/channels/205520502922543113/974342113850445874/1488185811261329498). All characters in the line after an ellipsis are consumed

@rasky
Copy link
Copy Markdown
Collaborator

rasky commented Apr 7, 2026

I've noticed more edge cases that didn't seem to be covered by this PR. I attempted my own fix here:
#857

The code is quite convoluted, but it seems to pass all testcases now (in my PR, the tests are based on yours but they cover more cases). Please let me know what you think. You can also run your PR against the new tests in #857 and try to fix the other cases. Maybe your approach is better than mine: I can't tell for sure.

@rasky rasky merged commit 107df82 into DragonMinded:preview Apr 11, 2026
4 checks passed
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