mirror of https://github.com/helix-editor/helix
Fix off by one error when opening multiple new lines with CRLF line endings (#13905)
parent
e88e48f41c
commit
02fe437622
|
@ -3727,10 +3727,12 @@ fn open(cx: &mut Context, open: Open, comment_continuation: CommentContinuation)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
for i in 0..count {
|
for i in 0..count {
|
||||||
// pos -> beginning of reference line,
|
// pos -> beginning of reference line,
|
||||||
// + (i * (1+indent_len + comment_len)) -> beginning of i'th line from pos (possibly including comment token)
|
// + (i * (line_ending_len + indent_len + comment_len)) -> beginning of i'th line from pos (possibly including comment token)
|
||||||
// + indent_len + comment_len -> -> indent for i'th line
|
// + indent_len + comment_len -> -> indent for i'th line
|
||||||
ranges.push(Range::point(
|
ranges.push(Range::point(
|
||||||
pos + (i * (1 + indent_len + comment_len)) + indent_len + comment_len,
|
pos + (i * (doc.line_ending.len_chars() + indent_len + comment_len))
|
||||||
|
+ indent_len
|
||||||
|
+ comment_len,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue