Expand description
See LineIndex.
Forked from rust-analyzer’s line-index. Our changes are tagged with a
SQUAWK: comment so they can be reapplied when resyncing with upstream:
\rand\r\nstart a new line, not just\n. Upstream only breaks on\n, which leaves a classic Mac file looking like one enormous line.- [
newlines] adds helpers upstream doesn’t have.
Structs§
- Line
- LineCol
(line, column)information in the native, UTF-8 encoding.- Line
Index - Maps flat
TextSizeoffsets to/from(line, column)representation. - Newline
With Trailing Newline - Like
UniversalNewlineIterator, but includes a trailing newline as an empty line. - Text
Range - A range in text, represented as a pair of
TextSize. - Text
Size - A measure of text length. Also, equivalently, an index into text.
- Universal
Newline Iterator - Like
str::lines, but accommodates LF, CRLF, and CR line endings, the latter of which are not supported bystr::lines. - Wide
Line Col (line, column)information in wide encodings.
Enums§
- Line
Ending - The line ending style used in Python source code. See https://docs.python.org/3/reference/lexical_analysis.html#physical-lines
- Wide
Encoding - A kind of wide character encoding.
Traits§
- Universal
Newlines - Extension trait for
strthat provides aUniversalNewlineIterator.
Functions§
- find_
newline - Finds the next newline character. Returns its position and the
LineEnding.