Set history size to ${CLING_HISTSIZE}
It was left unset. Then the default hist size was static_cast<size_t>(-1), which is practically equivalent to unlimited history size.
This commit is contained in:
parent
d47b49c3ee
commit
392d5365d5
@ -13,9 +13,10 @@
|
||||
#include "cling/MetaProcessor/MetaProcessor.h"
|
||||
#include "cling/Utils/Output.h"
|
||||
#include "textinput/Callbacks.h"
|
||||
#include "textinput/TextInput.h"
|
||||
#include "textinput/History.h"
|
||||
#include "textinput/StreamReader.h"
|
||||
#include "textinput/TerminalDisplay.h"
|
||||
#include "textinput/TextInput.h"
|
||||
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
@ -95,6 +96,17 @@ namespace cling {
|
||||
|
||||
TI->SetCompletion(Completion.get());
|
||||
|
||||
if (const char* HistSizeEnvvar = std::getenv("CLING_HISTSIZE")) {
|
||||
const size_t HistSize = std::strtoull(HistSizeEnvvar, nullptr, 0);
|
||||
|
||||
// std::strtoull() returns 0 if the parsing fails.
|
||||
// zero HistSize will disable history logging to file.
|
||||
// refer to textinput::History::AppendToFile()
|
||||
TI->SetHistoryMaxDepth(HistSize);
|
||||
TI->SetHistoryPruneLength(
|
||||
static_cast<size_t>(textinput::History::kPruneLengthDefault));
|
||||
}
|
||||
|
||||
bool Done = false;
|
||||
std::string Line;
|
||||
std::string Prompt("[cling]$ ");
|
||||
|
Loading…
x
Reference in New Issue
Block a user