Make sure bookmarks survive a document reload

While reloading a text document, the bookmarks got lost since their
associated QTextBlocks were deleted.

This patch makes sure that before reloading, the bookmarks are removed
non-persistently in the same way as when closing a document, and that
they are restored after the document was reloaded.

Currently, no effort is made to update the location of the bookmarks
based on the way the file changed.

Task-number: QTCREATORBUG-1281
Reviewed-by: dt
This commit is contained in:
Thorbjørn Lindeijer
2010-05-28 14:06:57 +02:00
parent a36d4b9b57
commit 76020b6152
9 changed files with 78 additions and 43 deletions

View File

@@ -76,7 +76,7 @@ public:
inline const StorageSettings &storageSettings() const { return m_storageSettings; }
inline const TabSettings &tabSettings() const { return m_tabSettings; }
DocumentMarker *documentMarker() const {return m_documentMarker; }
DocumentMarker *documentMarker() const { return m_documentMarker; }
//IFile
virtual bool save(const QString &fileName = QString());
@@ -116,8 +116,6 @@ public:
signals:
void titleChanged(QString title);
void aboutToReload();
void reloaded();
private:
QString m_fileName;
@@ -150,6 +148,7 @@ private:
void cleanWhitespace(QTextCursor& cursor, bool cleanIndentation, bool inEntireDocument);
void ensureFinalNewLine(QTextCursor& cursor);
void documentClosing();
};
} // namespace TextEditor