Conversation
screen sizes) The current implementation of wordwrap is only used in the case of a link. At which point it checks against a maxWidth of 76 and breaks the link, and/or inserts a newline character if whitespace is found. Introducing a newline character breaks the link and is seemingly unnecessary (may have to do with addonFit). Introducing a newline on whitespace character is also seemingly unecessary as a URL should not have a whitespace character anywhere but possibly the end of the string.
|
Closing, but the bug you reported did get fixed — just more narrowly than this patch.
allowWrapping = match[0].length < 76; // don't wrap lines that contain long URLsSo a line containing a long URL skips This PR removes One edge case is still unhandled: a URL under 76 characters on a line with no whitespace before the wrap column would still get force-split mid-URL. If you ever hit that in practice, it's worth a small follow-up — but it isn't a reason to drop wrapping wholesale. |
screen sizes)
The current implementation of wordwrap is only used in the case of a link. At which point it checks against a maxWidth of 76 and breaks the link, and/or inserts a newline character if whitespace is found.
Introducing a newline character breaks the link and is seemingly unnecessary (may have to do with addonFit).
Introducing a newline on whitespace character is also seemingly unecessary as a URL should not have a whitespace character anywhere but possibly the end of the string.
Possible fix for #38 and #42 (the latter issue is less clear).
One possible oversight is that wordwrap may be useful for the case where a string with multiple URLs passed in separated by a whitespace character that should actually be a newline is missed. This doesn't appear to be a problem.