Documents: a drawn CRLF reads back to its start
CI / platforms (windows-latest) (push) Failing after 10s
CI / site (push) Successful in 23s
CI / crate (push) Failing after 10m55s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s

A press at a CRLF line's end typed between CR and LF.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-15 13:04:25 -04:00
1 parent 5954132e76
commit c31d092583
3 files changed
+23 -7

No files matched your search

+11 -6
View File
@@ -319,12 +319,8 @@ fn aligned(drawn: &str, written: &str, escapes: Escapes) -> Vec<(usize, usize)>
let Some(s) = source[..j].last() else {
return out;
};
if d == s.ch {
j -= 1;
break s.at;
}
// A join: a line's end drawn as white space.
if d.is_whitespace() && s.ends_line() {
// A line's end, drawn or joined; CRLF is one end.
if d == s.ch || (d.is_whitespace() && s.ends_line()) {
j -= 1;
if s.ch == '\n' && j > 0 && source[j - 1].ch == '\r' && source[j - 1].raw == s.raw {
j -= 1;
@@ -393,6 +389,15 @@ mod tests {
assert_eq!(under(source, "next"), source.find("next").unwrap());
}
#[test]
fn a_drawn_crlf_reads_back_to_its_start() {
let source = "one\r\ntwo";
let inline = first(source);
let end = inline.text.find('\n').expect("a drawn line end");
assert_eq!(inline.source_at(source, end), Some(3));
assert_eq!(under(source, "two"), source.find("two").unwrap());
}
#[test]
fn joins_escapes_and_indents_read_back() {
let source = "a \\*star\\* x\n y";