From 27d389c36aa61fafadaff7a83ac778bc4cd4d689 Mon Sep 17 00:00:00 2001 From: joevt Date: Mon, 7 Aug 2023 11:26:24 -0700 Subject: [PATCH] debugger: Erase prompt when repeating command. Enterring a blank command continues the disassembly or stepping for one instruction. Erasing the prompt saves one line in the console so the disassembly doesn't appear double spaced. I don't know if the terminal control sequence works in Windows. --- debugger/debugger.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/debugger/debugger.cpp b/debugger/debugger.cpp index 456e28c6f..d8884b48a 100644 --- a/debugger/debugger.cpp +++ b/debugger/debugger.cpp @@ -438,6 +438,13 @@ static void mysig_handler(int signum) } #endif +static void delete_prompt() { +#ifndef _WIN32 + // move up, carriage return (move to column 0), erase from cursor to end of line + cout << "\e[A\r\e[0K"; +#endif +} + void enter_debugger() { string inp, cmd, addr_str, expr_str, reg_expr, last_cmd, reg_value_str, inst_string, inst_num_str, profile_name, sub_cmd; @@ -620,11 +627,17 @@ void enter_debugger() { if (context == 2) { #ifdef ENABLE_68K_DEBUGGER + if (cmd_repeat) { + delete_prompt(); + } for (; --count >= 0;) { exec_single_68k(); } #endif } else { + if (cmd_repeat) { + delete_prompt(); + } for (; --count >= 0;) { ppc_exec_single(); } @@ -703,6 +716,7 @@ void enter_debugger() { if (context == 2) { #ifdef ENABLE_68K_DEBUGGER if (cmd_repeat) { + delete_prompt(); addr = next_addr_68k; } else { @@ -713,6 +727,7 @@ void enter_debugger() { #endif } else { if (cmd_repeat) { + delete_prompt(); addr = next_addr_ppc; } else {