unsigned PrevCount;
std::string ContinuationOutput;
+
+ FILE *Out;
};
static const char *ElGetPromptFn(EditLine *EL) {
if (el_get(EL, EL_CLIENTDATA, &Data) == 0) {
if (!Data->ContinuationOutput.empty()) {
// This is the continuation of the AK_ShowCompletions branch below.
- FILE *Out;
- if (::el_get(EL, EL_GETFP, 1, &Out) != 0)
- return CC_ERROR;
+ FILE *Out = Data->Out;
// Print the required output (see below).
::fwrite(Data->ContinuationOutput.c_str(),
this->HistoryPath = getDefaultHistoryPath(ProgName);
Data->LE = this;
+ Data->Out = Out;
Data->Hist = ::history_init();
assert(Data->Hist);
LineEditor::~LineEditor() {
saveHistory();
- FILE *Out;
- if (::el_get(Data->EL, EL_GETFP, 1, &Out) != 0)
- Out = 0;
-
::history_end(Data->Hist);
::el_end(Data->EL);
-
- if (Out)
- ::fwrite("\n", 1, 1, Out);
+ ::fwrite("\n", 1, 1, Data->Out);
}
void LineEditor::saveHistory() {