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
+7 -3
View File
@@ -551,11 +551,15 @@ bool Project::didFileChange(const FileInfo& info) const
{
std::shared_ptr<TextAccess> storedFileContent = m_storage->getFileContent(info.path);
std::shared_ptr<TextAccess> diskFileContent = TextAccess::createFromFile(diskFileInfo.path);
if (diskFileContent->getLineCount() == storedFileContent->getLineCount())
const std::vector<std::string>& diskFileLines = diskFileContent->getAllLines();
const std::vector<std::string>& storedFileLines = storedFileContent->getAllLines();
if (diskFileLines.size() == storedFileLines.size())
{
for (size_t i = 0; i < diskFileContent->getLineCount(); i++)
for (size_t i = 0; i < diskFileLines.size(); i++)
{
if (diskFileContent->getLine(i) != storedFileContent->getLine(i))
if (diskFileLines[i] != storedFileLines[i])
{
return true;
}