forked from qt-creator/qt-creator
Editors: Fix that history of editors could grow
The "history of editors" is supposed to contain the order in which files/ documents were recently accessed. It is used for the "open documents window" (the Ctrl+Tab popup). In contrast to the "navigation history" it should contain each file/document only once. Since324de13b4eitems for suspended documents with the same file name were no longer removed. For suspended documents it is necessary to check for the same file name. This was so far not vital, but when we save the editor history in the session, these do not have a document when restoring, which would lead to an evergrowing editor history. Amends324de13b4eChange-Id: Ia4b7848a1265024d0463afbf7c1cd69189c4be97 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -245,7 +245,9 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
|
|||||||
|
|
||||||
for (int i = 0; i < history.size(); ++i) {
|
for (int i = 0; i < history.size(); ++i) {
|
||||||
const EditLocation &item = history.at(i);
|
const EditLocation &item = history.at(i);
|
||||||
if (item.document == document
|
// remove items that refer to the same document/file,
|
||||||
|
// or that are no longer in the "open documents"
|
||||||
|
if (item.document == document || (!item.document && item.filePath == document->filePath())
|
||||||
|| (!item.document && !DocumentModel::indexOfFilePath(item.filePath))) {
|
|| (!item.document && !DocumentModel::indexOfFilePath(item.filePath))) {
|
||||||
history.removeAt(i--);
|
history.removeAt(i--);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user