source_span
source_span copied to clipboard
Too many line breaks cause ArgumentError when calling highlight()
trafficstars
version: 1.8.2 (latest)
SourceFile.fromString('abc\r\n\r\ndef').span(2, 6).highlight()
Invalid argument(s): The context line "abc
" must contain "c
".
#0 new SourceSpanWithContext (package:source_span/src/span_with_context.dart:28:7)
#1 _Highlight._normalizeNewlines (package:source_span/src/highlighter.dart:567:12)
#2 new _Highlight.<anonymous closure> (package:source_span/src/highlighter.dart:528:21)
#3 new _Highlight (package:source_span/src/highlighter.dart:531:11)
#4 new Highlighter (package:source_span/src/highlighter.dart:62:31)
#5 SourceSpanMixin.highlight (package:source_span/src/span_mixin.dart:72:12)
From a brief look, this has to do with the span splitting one of the \r\n line endings.