prompt: filter ansi before calling readline

This commit is contained in:
Philippe Teuwen 2020-04-22 09:32:32 +02:00
commit 1f5544330c
2 changed files with 5 additions and 1 deletions

View file

@ -280,7 +280,9 @@ check_script:
} else {
prompt = PROXPROMPT_OFFLINE;
}
cmd = readline(prompt);
char prompt_filtered[PROXPROMPT_MAX_SIZE] = {0};
memcpy_filter_ansi(prompt_filtered, prompt, sizeof(prompt_filtered), !session.supports_colors);
cmd = readline(prompt_filtered);
fflush(NULL);
}
}

View file

@ -22,6 +22,8 @@
#define PROXPROMPT_OFFLINE "[" _BOLD_RED_("offline") "] pm3 --> "
#define PROXPROMPT_MAX_SIZE sizeof(PROXPROMPT_OFFLINE)
#define PROXHISTORY "history.txt"
#define PROXLOG "log_%Y%m%d.txt"
#define MAX_NESTED_CMDSCRIPT 10