diff --git a/liblangutil/SourceReferenceFormatterHuman.cpp b/liblangutil/SourceReferenceFormatterHuman.cpp index 430883996..ca947314e 100644 --- a/liblangutil/SourceReferenceFormatterHuman.cpp +++ b/liblangutil/SourceReferenceFormatterHuman.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include using namespace std; @@ -72,8 +71,8 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ if (_ref.position.line < 0) { - frameColored() << "--> "; - m_stream << _ref.sourceName << "\n"; + frameColored() << "-->"; + m_stream << ' ' << _ref.sourceName << '\n'; return; // No line available, nothing else to print } @@ -81,48 +80,55 @@ void SourceReferenceFormatterHuman::printSourceLocation(SourceReference const& _ string leftpad = string(line.size(), ' '); // line 0: source name - frameColored() << leftpad << "--> "; - m_stream << _ref.sourceName << ":" << line << ":" << (_ref.position.column + 1) << ":" << '\n'; + m_stream << leftpad; + frameColored() << "-->"; + m_stream << ' ' << _ref.sourceName << ':' << line << ':' << (_ref.position.column + 1) << ":\n"; if (!_ref.multiline) { int const locationLength = _ref.endColumn - _ref.startColumn; // line 1: - m_stream << leftpad; - frameColored() << " |" << '\n'; + m_stream << leftpad << ' '; + frameColored() << '|'; + m_stream << '\n'; // line 2: - frameColored() << line << " | "; - m_stream << _ref.text.substr(0, _ref.startColumn); + frameColored() << line << " |"; + m_stream << ' ' << _ref.text.substr(0, _ref.startColumn); highlightColored() << _ref.text.substr(_ref.startColumn, locationLength); m_stream << _ref.text.substr(_ref.endColumn) << '\n'; // line 3: - m_stream << leftpad; - frameColored() << " | "; + m_stream << leftpad << ' '; + frameColored() << '|'; + m_stream << ' '; for_each( _ref.text.cbegin(), _ref.text.cbegin() + _ref.startColumn, [this](char ch) { m_stream << (ch == '\t' ? '\t' : ' '); } ); - diagColored() << string(locationLength, '^') << '\n'; + diagColored() << string(locationLength, '^'); + m_stream << '\n'; } else { // line 1: - m_stream << leftpad; - frameColored() << " |" << '\n'; + m_stream << leftpad << ' '; + frameColored() << '|'; + m_stream << '\n'; // line 2: - frameColored() << line << " | "; - m_stream << _ref.text.substr(0, _ref.startColumn); + frameColored() << line << " |"; + m_stream << ' ' << _ref.text.substr(0, _ref.startColumn); highlightColored() << _ref.text.substr(_ref.startColumn) << '\n'; // line 3: - frameColored() << leftpad << " | "; - m_stream << string(_ref.startColumn, ' '); - diagColored() << "^ (Relevant source part starts here and spans across multiple lines).\n"; + m_stream << leftpad << ' '; + frameColored() << '|'; + m_stream << ' ' << string(_ref.startColumn, ' '); + diagColored() << "^ (Relevant source part starts here and spans across multiple lines)."; + m_stream << '\n'; } }