From 1d0849f521331dc1ec8619d154eaa90b471219c3 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 4 Sep 2019 11:19:20 -0300 Subject: [PATCH] Python Console - only save max 100 history items --- src/Gui/PythonConsole.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index e09fbb0a5c..c2eebbbe6d 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1423,7 +1423,10 @@ void PythonConsole::saveHistory() const QFile f(d->historyFile); if (f.open(QIODevice::WriteOnly)) { QTextStream t (&f); - const QStringList& hist = d->history.values(); + QStringList hist = d->history.values(); + // only save last 100 entries so we don't inflate forever... + if (hist.length() > 100) + hist = hist.mid(hist.length()-100); for (QStringList::ConstIterator it = hist.begin(); it != hist.end(); ++it) t << *it << "\n"; f.close();