diff --git a/liblangutil/CharStream.cpp b/liblangutil/CharStream.cpp index be236893f..046aca5d3 100644 --- a/liblangutil/CharStream.cpp +++ b/liblangutil/CharStream.cpp @@ -93,10 +93,13 @@ string CharStream::lineAtPosition(int _position) const lineStart = 0; else lineStart++; - return m_source.substr( + string line = m_source.substr( lineStart, min(m_source.find('\n', lineStart), m_source.size()) - lineStart ); + if (!line.empty() && line.back() == '\r') + line.pop_back(); + return line; } tuple CharStream::translatePositionToLineColumn(int _position) const