Open Measter opened 2 years ago
My suggested fix, which I think should work (at least, it did for the above image), would be to replace lines()
with split_terminator('\n')
, and then manually check for and trim \r
for the line:
let (line, newline_len) = if let Some(trimmed_line) = line.strip_suffix('\r') {
(trimmed_line, 2)
} else {
(line, 1)
};
That removes both kinds of newline leaving the line in the same state the current code does, and also gets you the correct newline length.
Temporarily patched in c2b5e34, but needs a better solution.
Ah, I was wondering why the labels were disappearing when I have errors near the end of the source file. Fixed it by replacing CRLF with LF newlines.
This should be fixed in 0.1.5
, which has just been released.
Right now the implementation of creating a
Source
from a string iterates over lines by usingstr::lines
which hides whether a line ended with\n
or\r\n
. This causes it to put labels in the wrong place, or even lose them if they're near the end of the file, as demonstrated here: