Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many line breaks cause ArgumentError when calling highlight() #79

Open
isoos opened this issue Feb 23, 2022 · 1 comment
Open

Too many line breaks cause ArgumentError when calling highlight() #79

isoos opened this issue Feb 23, 2022 · 1 comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@isoos
Copy link

isoos commented Feb 23, 2022

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)
@devoncarew devoncarew added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Feb 3, 2023
@devoncarew
Copy link
Member

From a brief look, this has to do with the span splitting one of the \r\n line endings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants