Fixes SourceLocation extraction on multiline locations with a too long first line.

This commit is contained in:
Christian Parpart 2019-01-07 11:33:14 +01:00
parent d597b1dbb2
commit c7074a365e
No known key found for this signature in database
GPG Key ID: 19BC8DD20312C929

View File

@ -58,7 +58,9 @@ SourceReference SourceReferenceExtractor::extract(SourceLocation const* _locatio
int locationLength = isMultiline ? line.length() - start.column : end.column - start.column;
if (locationLength > 150)
{
line = line.substr(0, start.column + 35) + " ... " + line.substr(end.column - 35);
int const lhs = start.column + 35;
int const rhs = (isMultiline ? line.length() : end.column) - 35;
line = line.substr(0, lhs) + " ... " + line.substr(rhs);
end.column = start.column + 75;
locationLength = 75;
}