fix colored readline prompt bug
This commit is contained in:
@@ -18,15 +18,14 @@
|
||||
|
||||
#define PROXPROMPT_COMPOSE "[" "%s%s" "] pm3 --> "
|
||||
|
||||
#define PROXPROMPT_CTX_SCRIPTFILE "|" _GREEN_("script")
|
||||
#define PROXPROMPT_CTX_SCRIPTCMD "|" _GREEN_("script")
|
||||
#define PROXPROMPT_CTX_STDIN "|" _GREEN_("script")
|
||||
#define PROXPROMPT_CTX_SCRIPTFILE "|" _RL_GREEN_("script")
|
||||
#define PROXPROMPT_CTX_SCRIPTCMD "|" _RL_GREEN_("script")
|
||||
#define PROXPROMPT_CTX_STDIN "|" _RL_GREEN_("script")
|
||||
#define PROXPROMPT_CTX_INTERACTIVE ""
|
||||
|
||||
#define PROXPROMPT_DEV_USB _BOLD_GREEN_("usb")
|
||||
#define PROXPROMPT_DEV_FPC _BOLD_GREEN_("fpc")
|
||||
#define PROXPROMPT_DEV_OFFLINE _BOLD_RED_("offline")
|
||||
|
||||
#define PROXPROMPT_DEV_USB _RL_BOLD_GREEN_("usb")
|
||||
#define PROXPROMPT_DEV_FPC _RL_BOLD_GREEN_("fpc")
|
||||
#define PROXPROMPT_DEV_OFFLINE _RL_BOLD_RED_("offline")
|
||||
|
||||
#define PROXHISTORY "history.txt"
|
||||
#define PROXLOG "log_%Y%m%d.txt"
|
||||
|
||||
@@ -358,6 +358,10 @@ void memcpy_filter_ansi(void *dest, const void *src, size_t n, bool filter) {
|
||||
uint8_t *rsrc = (uint8_t *)src;
|
||||
uint16_t si = 0;
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
if ((i < n)
|
||||
&& ((rsrc[i] == '\001') || (rsrc[i] == '\002')))
|
||||
// skip readline special markers
|
||||
continue;
|
||||
if ((i < n - 1)
|
||||
&& (rsrc[i] == '\x1b')
|
||||
&& (rsrc[i + 1] >= 0x40)
|
||||
|
||||
Reference in New Issue
Block a user