Closed kdheepak closed 2 weeks ago
The idea of line is to have no new lines. So… not sure which is the more correct behaviour?
I would expect this to be correct behaviour:
let line = Line::raw("hello world\ngoodbye world"); dbg!(line.spans.len()) // 2
precisely because of the reason you've stated: Line
shouldn't have newlines.
Two spans makes it possible to use &strs
, one span would mean that an owned string would have to be constructed from the two lines. I think we currently just filter out the newlines when displaying the spans, so the behavior probably just works alright as-is, but going to two makes sense.
Description
Line::from
doesn't split the spans on new lines: