Skip to content

Commit 27d389c

Browse files
joevtdingusdev
authored andcommitted
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.
1 parent 625e474 commit 27d389c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

debugger/debugger.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,13 @@ static void mysig_handler(int signum)
438438
}
439439
#endif
440440

441+
static void delete_prompt() {
442+
#ifndef _WIN32
443+
// move up, carriage return (move to column 0), erase from cursor to end of line
444+
cout << "\e[A\r\e[0K";
445+
#endif
446+
}
447+
441448
void enter_debugger() {
442449
string inp, cmd, addr_str, expr_str, reg_expr, last_cmd, reg_value_str,
443450
inst_string, inst_num_str, profile_name, sub_cmd;
@@ -620,11 +627,17 @@ void enter_debugger() {
620627

621628
if (context == 2) {
622629
#ifdef ENABLE_68K_DEBUGGER
630+
if (cmd_repeat) {
631+
delete_prompt();
632+
}
623633
for (; --count >= 0;) {
624634
exec_single_68k();
625635
}
626636
#endif
627637
} else {
638+
if (cmd_repeat) {
639+
delete_prompt();
640+
}
628641
for (; --count >= 0;) {
629642
ppc_exec_single();
630643
}
@@ -703,6 +716,7 @@ void enter_debugger() {
703716
if (context == 2) {
704717
#ifdef ENABLE_68K_DEBUGGER
705718
if (cmd_repeat) {
719+
delete_prompt();
706720
addr = next_addr_68k;
707721
}
708722
else {
@@ -713,6 +727,7 @@ void enter_debugger() {
713727
#endif
714728
} else {
715729
if (cmd_repeat) {
730+
delete_prompt();
716731
addr = next_addr_ppc;
717732
}
718733
else {

0 commit comments

Comments
 (0)