diff --git a/lib/UserInterface/textinput/TextInput.cpp b/lib/UserInterface/textinput/TextInput.cpp index 394bab79..c724e61f 100644 --- a/lib/UserInterface/textinput/TextInput.cpp +++ b/lib/UserInterface/textinput/TextInput.cpp @@ -49,8 +49,8 @@ namespace textinput { } void - TextInput::TakeInput(std::string &input) { - if (fLastReadResult != kRRReadEOLDelimiter + TextInput::TakeInput(std::string &input, bool force) { + if (!force && fLastReadResult != kRRReadEOLDelimiter && fLastReadResult != kRREOF) { input.clear(); return; @@ -67,12 +67,14 @@ namespace textinput { ReleaseInputOutput(); - if (fLastReadResult == kRRReadEOLDelimiter) { + if (force || fLastReadResult == kRRReadEOLDelimiter) { // Input has been taken, we can continue reading. fLastReadResult = kRRNone; // We will have to redraw the prompt, even if unchanged. fNeedPromptRedraw = true; - } // else keep EOF. + } else { + fLastReadResult = kRREOF; + } } bool diff --git a/lib/UserInterface/textinput/TextInput.h b/lib/UserInterface/textinput/TextInput.h index 193e7af9..abe6a169 100644 --- a/lib/UserInterface/textinput/TextInput.h +++ b/lib/UserInterface/textinput/TextInput.h @@ -69,7 +69,7 @@ namespace textinput { EReadResult GetReadState() const { return fLastReadResult; } char GetLastKey() const { return fLastKey; } const std::string& GetInput(); - void TakeInput(std::string& input); // Take and reset input + void TakeInput(std::string& input, bool force = false); // Take and reset input bool AtEOL() const { return fLastReadResult == kRRReadEOLDelimiter || AtEOF(); } bool AtEOF() const { return fLastReadResult == kRREOF; } bool HavePendingInput() const;