logic: Fixes in and with TextAccess

* fixed Textaccess removing last line with single character when loading from string
* fixed file comparison using wrong index ranges
This commit is contained in:
Eberhard Graether
2017-10-12 11:26:48 +02:00
parent c39168967f
commit b5ff43a821
3 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ std::vector<std::string> TextAccess::getLines(const unsigned int firstLineNumber
return std::vector<std::string>(first, last);
}
std::vector<std::string> TextAccess::getAllLines() const
const std::vector<std::string>& TextAccess::getAllLines() const
{
return m_lines;
}
@@ -124,7 +124,7 @@ std::vector<std::string> TextAccess::splitStringByLines(const std::string& text)
index = text.find('\n', prevIndex);
}
if (prevIndex < text.length() - 1)
if (prevIndex < text.length())
{
result.push_back(text.substr(prevIndex));
}