mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
SourceLocation::singleLineSnippet(): Handle \r\n line endings correctly
This commit is contained in:
parent
a7612ce873
commit
98ab6d91ed
@ -138,7 +138,7 @@ string CharStream::singleLineSnippet(string const& _sourceCode, SourceLocation c
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
string cut = _sourceCode.substr(static_cast<size_t>(_location.start), static_cast<size_t>(_location.end - _location.start));
|
string cut = _sourceCode.substr(static_cast<size_t>(_location.start), static_cast<size_t>(_location.end - _location.start));
|
||||||
auto newLinePos = cut.find_first_of("\n");
|
auto newLinePos = cut.find_first_of("\n\r");
|
||||||
if (newLinePos != string::npos)
|
if (newLinePos != string::npos)
|
||||||
cut = cut.substr(0, newLinePos) + "...";
|
cut = cut.substr(0, newLinePos) + "...";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user