-
Notifications
You must be signed in to change notification settings - Fork 212
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
Roll our own wrapping function for help #602
Conversation
This saves us writing to a buffer multiple times, and so makes things much, much faster.
I was literally writing a word wrapper. I wasn't sure if I would make it a textutils thing or a cc.pretty thing or a new module. I'll still make a PR and then maybe it can replace this. (Now I'm glad that I didn't actually get anywhere because I was playing games with people.) |
So I copied the code from here and started writing tests. This one fails with
I would expect it to see the end of the word |
end | ||
else | ||
-- Print a word normally | ||
if width - #current_line - 1 < #word then push_line() end |
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.
Remove the -1 and then text wraps how I expect it to in the conversation tab.
This saves us writing to a buffer multiple times, and so makes things much, much faster.
This saves us writing to a buffer multiple times, and so makes things much, much faster.
As in, it's actually usable on copy-cat now!
At this point, it might be worth the actual paginator into a separate utility module. Then we could deprecated
textutils.pagedPrint
and point towards that instead - sadly I don't think it's really possible to replicate the behaviour of_nFreeLines
.I'm not 100% sure how I feel about exposing entire UI interfaces from a module though. We'll have to see.