summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2010-12-27 14:50:48 +0100
committerLars-Dominik Braun <lars@6xq.net>2010-12-27 14:50:48 +0100
commiteadc96008ca6fa0a335ab35daaff0cfd24546cf9 (patch)
tree22c0a803c80e999d6e04b1461ee31abd25bceb31 /src
parentb452bc6cd392fcb7631a5d5c4d794aafd5e380e9 (diff)
downloadpianobar-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.
Diffstat (limited to 'src')
-rw-r--r--src/ui.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ui.c b/src/ui.c
index 3edccc7..c1aadab 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -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