skip reading if retrievalLimit is 0

depth-refraction
Kindi 2 years ago
parent 35b2292e61
commit 65cbf7f17c

@ -709,10 +709,11 @@ namespace MWGui
const auto filePath = mCfgMgr.getUserConfigPath() / "console_history.txt";
const size_t retrievalLimit = Settings::Manager::getSize("console history buffer size", "General");
// Read the previous session's commands from the file
if (retrievalLimit > 0)
{
std::ifstream historyFile(filePath);
std::string line;
// Read the previous session's commands from the file
while (std::getline(historyFile, line))
{
// Truncate the list if it exceeds the retrieval limit
@ -720,8 +721,8 @@ namespace MWGui
mCommandHistory.pop_front();
mCommandHistory.push_back(line);
}
historyFile.close();
}
mCurrent = mCommandHistory.end();
try

Loading…
Cancel
Save