Merge branch 'bugfix/linenoise_unint_buffer_and_color' into 'master'

console: linenoise: fix usage of an uninitialized buffer, fix no-color output

Closes IDF-2752

See merge request espressif/esp-idf!17470
pull/8607/head
Mahavir Jain 2022-03-14 12:20:40 +08:00
commit 177cb601c6
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -368,6 +368,8 @@ static esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_
#if CONFIG_LOG_COLORS
console_config.hint_color = atoi(LOG_COLOR_CYAN);
#else
console_config.hint_color = -1;
#endif
ret = esp_console_init(&console_config);
if (ret != ESP_OK) {

Wyświetl plik

@ -501,9 +501,10 @@ void refreshShowHints(struct abuf *ab, struct linenoiseState *l, int plen) {
int hintmaxlen = l->cols-(plen+l->len);
if (hintlen > hintmaxlen) hintlen = hintmaxlen;
if (bold == 1 && color == -1) color = 37;
if (color != -1 || bold != 0)
if (color != -1 || bold != 0) {
snprintf(seq,64,"\033[%d;%d;49m",bold,color);
abAppend(ab,seq,strlen(seq));
abAppend(ab,seq,strlen(seq));
}
abAppend(ab,hint,hintlen);
if (color != -1 || bold != 0)
abAppend(ab,"\033[0m",4);