diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2010-12-27 14:50:48 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2010-12-27 14:50:48 +0100 |
commit | eadc96008ca6fa0a335ab35daaff0cfd24546cf9 (patch) | |
tree | 22c0a803c80e999d6e04b1461ee31abd25bceb31 | |
parent | b452bc6cd392fcb7631a5d5c4d794aafd5e380e9 (diff) | |
download | pianobar-eadc96008ca6fa0a335ab35daaff0cfd24546cf9.tar.gz pianobar-eadc96008ca6fa0a335ab35daaff0cfd24546cf9.tar.bz2 pianobar-eadc96008ca6fa0a335ab35daaff0cfd24546cf9.zip |
Erase current line before printing new message
Parts of the current song's time didn't get erased when renaming a
station.
-rw-r--r-- | src/ui.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -48,31 +48,32 @@ typedef int (*BarSortFunc_t) (const void *, const void *); * @param message */ inline void BarUiMsg (uiMsg_t type, const char *format, ...) { + #define ANSI_CLEAR_LINE "\033[2K" va_list fmtargs; switch (type) { case MSG_INFO: - printf ("(i) "); + printf (ANSI_CLEAR_LINE "(i) "); break; case MSG_PLAYING: - printf ("|> "); + printf (ANSI_CLEAR_LINE "|> "); break; case MSG_TIME: - printf ("# "); + printf (ANSI_CLEAR_LINE "# "); break; case MSG_ERR: - printf ("/!\\ "); + printf (ANSI_CLEAR_LINE "/!\\ "); break; case MSG_QUESTION: - printf ("[?] "); + printf (ANSI_CLEAR_LINE "[?] "); break; case MSG_LIST: - printf (" "); + printf (ANSI_CLEAR_LINE "\t"); break; default: @@ -83,6 +84,8 @@ inline void BarUiMsg (uiMsg_t type, const char *format, ...) { va_end (fmtargs); fflush (stdout); + + #undef ANSI_CLEAR_LINE } /* prints human readable status message based on return value |