Closed cessen closed 2 years ago
Also related to #43
Oh! Right. I feel silly now. Basically a duplicate.
I split Ropey's str_utils
module off into a separate crate, str_indices, which now also implements two additional ways of line counting:
That was the "hard" part. The rest should be relatively straightforward:
str_indices
.Although straightforward, there are a lot of unit tests to update. So it's a bit of a project still.
Added in 38531e083f8cf5c5b1aeb328361895fb5a9b867c.
There are two new feature flags:
cr_lines
, which enables carriage return line break handling.unicode_lines
, which enables full Unicode line break handling.Both features are enabled by default for backwards compatibility, but can be disabled to strip things down. Note that unicode_lines
implies cr_lines
, since the former is a superset of the latter.
On second thought: re-opening, just to remind myself to add proper documentation for this before the next release.
Documentation done.
Most other software does not conform to the Unicode spec when it comes to line breaks. This (understandably) gives people pause when deciding whether to use Ropey or not, because although Ropey is "correct" in the way it counts line breaks, it's not compatible with other software if any line breaks other than LF/CRLF are present in a file.
We can solve this with a feature flag that implements the simpler, non-Unicode-conformant line break counting that is common to most other software.