diff --git a/libs/libcommon/src/LineReader.cpp b/libs/libcommon/src/LineReader.cpp index 4a3a737fe7c0453d7d6f8af31ab2776ce03aae79..22e0019803d8bb89f25384c9e5b265d520ce9def 100644 --- a/libs/libcommon/src/LineReader.cpp +++ b/libs/libcommon/src/LineReader.cpp @@ -81,7 +81,12 @@ String LineReader::readLine(const String & first_prompt, const String & second_p } if (input.empty()) - continue; + { + if (!line.empty() && !delimiter && !hasInputData()) + break; + else + continue; + } is_multiline = (input.back() == extender) || (delimiter && input.back() != delimiter) || hasInputData(); @@ -96,18 +101,16 @@ String LineReader::readLine(const String & first_prompt, const String & second_p line += (line.empty() ? "" : " ") + input; if (!is_multiline) - { - if (line != prev_line) - { - addToHistory(line); - prev_line = line; - } + break; + } - return line; - } + if (!line.empty() && line != prev_line) + { + addToHistory(line); + prev_line = line; } - return {}; + return line; } LineReader::InputStatus LineReader::readOneLine(const String & prompt)