From 1a416840a1d4f6ba55a4d3ac6b1aebfc3356ebbc Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 24 Jun 2019 15:15:05 +0200 Subject: [PATCH] DocumentManager: Fix off-by-one error in max number of recent files Also update the value so we don't introduce a behavior change. Change-Id: Ie6d474c0d62f041afd84acdd90c1c09d23c57d46 Reviewed-by: hjk --- src/plugins/coreplugin/documentmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 933b20bd3fc..b6ddfee841d 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -153,7 +153,7 @@ public: QSet m_expectedFileNames; // set of file names without normalization QList m_recentFiles; - static const int m_maxRecentFiles = 7; + static const int m_maxRecentFiles = 8; bool m_postponeAutoReload = false; bool m_blockActivated = false; @@ -1278,7 +1278,7 @@ void DocumentManager::addToRecentFiles(const QString &fileName, Id editorId) if (fileKey == recentFileKey) it.remove(); } - if (d->m_recentFiles.count() > d->m_maxRecentFiles) + if (d->m_recentFiles.count() == d->m_maxRecentFiles) d->m_recentFiles.removeLast(); d->m_recentFiles.prepend(RecentFile(fileName, editorId)); }