From 704d3665110ee654b92170d484566fde42de1d79 Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Fri, 19 Feb 2021 01:45:52 +0800 Subject: [PATCH] [posix] set readline screen cols according to CLI config (#6183) The default screen size might be too small for CLI command input/output. This commit configures the screen cols to according to CLI configs. --- src/posix/console_cli.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/posix/console_cli.cpp b/src/posix/console_cli.cpp index 735e983d4..18fa1909f 100644 --- a/src/posix/console_cli.cpp +++ b/src/posix/console_cli.cpp @@ -57,6 +57,8 @@ #include +#include "common/code_utils.hpp" + #include "openthread-core-config.h" #include "platform-posix.h" @@ -95,7 +97,10 @@ void otxConsoleInit(otInstance *aInstance) rl_instream = stdin; rl_outstream = stdout; rl_inhibit_completion = true; - sReadFd = fileno(rl_instream); + + rl_set_screen_size(0, OT_MAX(OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH, OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE)); + + sReadFd = fileno(rl_instream); rl_callback_handler_install(sPrompt, InputCallback); otCliConsoleInit(aInstance, OutputCallback, nullptr); }