From 457483eafef530d15cb0d75b78167345020c3156 Mon Sep 17 00:00:00 2001 From: Ray Lee Date: Thu, 5 Aug 2021 11:03:30 +0800 Subject: [PATCH] ui improve --- client/src/proxmark3.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index d1507923a..dd0ad9be2 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -127,6 +127,15 @@ static void prompt_compose(char *buf, size_t buflen, const char *promptctx, cons static int check_comm(void) { // If communications thread goes down. Device disconnected then this should hook up PM3 again. if (IsCommunicationThreadDead() && session.pm3_present) { +#ifdef HAVE_READLINE + char* saved_line; + int saved_point; + saved_point = rl_point; + saved_line = rl_copy_text(0, rl_end); + rl_set_prompt(""); + rl_replace_line("", 0); + rl_redisplay(); +#endif PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") " mode. Use "_YELLOW_("\"hw connect\"") " to reconnect\n"); prompt_dev = PROXPROMPT_DEV_OFFLINE; #ifdef HAVE_READLINE @@ -135,7 +144,10 @@ static int check_comm(void) { char prompt_filtered[PROXPROMPT_MAX_SIZE] = {0}; memcpy_filter_ansi(prompt_filtered, prompt, sizeof(prompt_filtered), !session.supports_colors); rl_set_prompt(prompt_filtered); - rl_forced_update_display(); + rl_replace_line(saved_line, 0); + rl_point = saved_point; + rl_redisplay(); + free(saved_line); #endif CloseProxmark(session.current_device); }