Skip to content

Commit

Permalink
debugger: Erase prompt when repeating command.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joevt authored and dingusdev committed Nov 9, 2024
1 parent 625e474 commit 27d389c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions debugger/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -703,6 +716,7 @@ void enter_debugger() {
if (context == 2) {
#ifdef ENABLE_68K_DEBUGGER
if (cmd_repeat) {
delete_prompt();
addr = next_addr_68k;
}
else {
Expand All @@ -713,6 +727,7 @@ void enter_debugger() {
#endif
} else {
if (cmd_repeat) {
delete_prompt();
addr = next_addr_ppc;
}
else {
Expand Down

0 comments on commit 27d389c

Please sign in to comment.