aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/SourceReferenceFormatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/interface/SourceReferenceFormatter.cpp')
-rw-r--r--libsolidity/interface/SourceReferenceFormatter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libsolidity/interface/SourceReferenceFormatter.cpp b/libsolidity/interface/SourceReferenceFormatter.cpp
index 0f014372..4724fc7f 100644
--- a/libsolidity/interface/SourceReferenceFormatter.cpp
+++ b/libsolidity/interface/SourceReferenceFormatter.cpp
@@ -55,8 +55,14 @@ void SourceReferenceFormatter::printSourceLocation(SourceLocation const* _locati
}
if (line.length() > 150)
{
- line = " ... " + line.substr(startColumn, locationLength) + " ... ";
- startColumn = 5;
+ int len = line.length();
+ line = line.substr(max(0, startColumn - 35), min(startColumn, 35) + min(locationLength + 35, len - startColumn));
+ if (startColumn + locationLength + 35 < len)
+ line += " ...";
+ if (startColumn > 35) {
+ line = " ... " + line;
+ startColumn = 40;
+ }
endColumn = startColumn + locationLength;
}