From c7074a365e3ff503b20c2a2f8638f5d3b7a8616b Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Mon, 7 Jan 2019 11:33:14 +0100 Subject: Fixes SourceLocation extraction on multiline locations with a too long first line. --- liblangutil/SourceReferenceExtractor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'liblangutil/SourceReferenceExtractor.cpp') diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp index 4502bb23..1a6dbdb3 100644 --- a/liblangutil/SourceReferenceExtractor.cpp +++ b/liblangutil/SourceReferenceExtractor.cpp @@ -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; } -- cgit v1.2.3