From bf4c1bdc0e3b2a9420010a53418050cc35f3bd8d Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 19 Mar 2019 21:30:52 -0400 Subject: [PATCH] use vt100 escape codes (in the future, should switch to termcap/terminfo) to erase previous line when stepping to clean up the display. --- src/debug_shell.re2c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/debug_shell.re2c b/src/debug_shell.re2c index fe2af15..1fcd43f 100644 --- a/src/debug_shell.re2c +++ b/src/debug_shell.re2c @@ -130,6 +130,20 @@ static char *get_resource_path(const char *leaf) { } #endif +void clear_line(void) { + /* carriage return, clear_eol */ + /* cr, ce */ + fputs("\r\x1b[K", stdout); +} + +void clear_prev_line(void) { + /* carriage return, cursor_up, clear_eol */ + /* cr, up, ce */ + fputs("\r\x1b[A\x1b[K", stdout); + +} + + /* * todo * - tool break support @@ -1352,6 +1366,8 @@ command: engine.kpc = addr; } g_stepping = 1; + + clear_prev_line(); return 1; } @@ -1369,6 +1385,7 @@ command: set_bp('T', tmp); } + clear_prev_line(); return 1; }