From 12e68d7a2888a4b45752579fbe50aa7e989d24e8 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 19 Jul 2025 16:52:27 +0200 Subject: [PATCH] Change readline hack logic for async dbg msg to be ready for readline 8.3 --- CHANGELOG.md | 3 ++- client/src/ui.c | 14 ++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60721b79c..d7281d870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Changed readline hack logic for async dbg msg to be ready for readline 8.3 (@doegox) +- Improved To avoid conflicts with ModemManager on Linux, is recommended to masking the service (@grugnoymeme) - Changed `data crypto` - now also handles AES-256 (@iceman1001) - Changed `hf mfdes info` - add recognition of Swissbit iShield Key Mifare (@ah01) - Changed `hf mf info` - add detection for unknown backdoor keys and for some backdoor variants (@doegox) @@ -18,7 +20,6 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac - Changed `mem load` - now handles UL-C and UL-AES dictionary files (@iceman1001) - Changed `hf mfu sim` - now support UL-C simulation (@iceman1001) - Added `!` - run system commands from inside the client. Potentially dangerous if running client as SUDO, SU, ROOT (@iceman1001) -- Improved To avoid conflicts with ModemManager on Linux, is recommended to masking the service (@grugnoymeme) ## [Daddy Iceman.4.20469][2025-06-16] - Fixed edge case in fm11rf08s key recovery tools (@doegox) diff --git a/client/src/ui.c b/client/src/ui.c index 4aed59a45..1901ac9ef 100644 --- a/client/src/ui.c +++ b/client/src/ui.c @@ -424,18 +424,13 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { #ifdef RL_STATE_READCMD // We are using GNU readline. libedit (OSX) doesn't support this flag. int need_hack = (rl_readline_state & RL_STATE_READCMD) > 0; - char *saved_line; - int saved_point; + char *saved_line = NULL; if (need_hack) { - saved_point = rl_point; saved_line = rl_copy_text(0, rl_end); - rl_save_prompt(); - rl_replace_line("", 0); - rl_redisplay(); + rl_clear_visible_line(); } #endif - va_start(argptr, fmt); vsnprintf(buffer, sizeof(buffer), fmt, argptr); va_end(argptr); @@ -453,14 +448,13 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { if (linefeed) { fprintf(stream, "\n"); } + fflush(stream); } #ifdef RL_STATE_READCMD - // We are using GNU readline. libedit (OSX) doesn't support this flag. if (need_hack) { - rl_restore_prompt(); + rl_on_new_line(); rl_replace_line(saved_line, 0); - rl_point = saved_point; rl_redisplay(); free(saved_line); }