fix shell standalone

This commit is contained in:
proddy
2025-03-03 15:12:28 +01:00
parent c05793f64f
commit e121fdb47f

View File

@@ -113,6 +113,7 @@ void Shell::loop_one() {
return; return;
} }
switch (mode_) { switch (mode_) {
case Mode::NORMAL: case Mode::NORMAL:
output_logs(); output_logs();
@@ -305,15 +306,15 @@ void Shell::loop_normal() {
break; break;
} }
// common for all, display the complete line #ifndef EMSESP_STANDALONE
// added for EMS-ESP // added for EMS-ESP. Display the complete line
erase_current_line(); erase_current_line();
prompt_displayed_ = false; prompt_displayed_ = false;
display_prompt(); display_prompt();
if (cursor_) { if (cursor_) {
printf("\033[%dD", cursor_); printf("\033[%dD", cursor_);
} }
#endif
previous_ = c; previous_ = c;
@@ -519,7 +520,11 @@ void Shell::maximum_command_line_length(size_t length) {
void Shell::process_command() { void Shell::process_command() {
// added for EMS-ESP // added for EMS-ESP
if (line_buffer_.empty()) { if (line_buffer_.empty()) {
#ifndef EMSESP_STANDALONE
println(); println();
#else
display_prompt();
#endif
return; return;
} }
@@ -544,7 +549,9 @@ void Shell::process_command() {
CommandLine command_line{line1}; CommandLine command_line{line1};
#ifndef EMSESP_STANDALONE
println(); println();
#endif
prompt_displayed_ = false; prompt_displayed_ = false;
if (!command_line->empty()) { if (!command_line->empty()) {
@@ -564,8 +571,7 @@ void Shell::process_command() {
display_prompt(); display_prompt();
} }
// don't think we need this for EMS-ESP on ESP32 ::yield();
// ::yield();
} }
void Shell::process_completion() { void Shell::process_completion() {
@@ -581,7 +587,6 @@ void Shell::process_completion() {
for (auto & help : completion.help) { for (auto & help : completion.help) {
std::string help_line = help.to_string(maximum_command_line_length_); std::string help_line = help.to_string(maximum_command_line_length_);
println(help_line); println(help_line);
} }
} }