about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-19 23:56:54 +0000
committerJames Booth <boothj5@gmail.com>2012-11-19 23:56:54 +0000
commit2d590a81e0fd5f2674c0c41e9c1b412059590f4e (patch)
tree51bcffa4d9c058656c5da7e1379a428f99a747a3
parent118d97cd90701bcc05e286f35dae6f84ef92a3ff (diff)
downloadprofani-tty-2d590a81e0fd5f2674c0c41e9c1b412059590f4e.tar.gz
Status bar message now correctly overwrites previous message
-rw-r--r--src/status_bar.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/status_bar.c b/src/status_bar.c
index bfd25fca..ad042cd1 100644
--- a/src/status_bar.c
+++ b/src/status_bar.c
@@ -184,13 +184,31 @@ status_bar_get_password(void)
 void
 status_bar_print_message(const char * const msg)
 {
-    if (message != NULL)
+    if (message != NULL) {
         free(message);
+        message = NULL;
+    }
+
+    wclear(status_bar);
 
     message = (char *) malloc((strlen(msg) + 1) * sizeof(char));
     strcpy(message, msg);
     mvwprintw(status_bar, 0, 9, message);
 
+    int cols = getmaxx(stdscr);
+
+    wattron(status_bar, COLOUR_BAR_DRAW);
+    mvwprintw(status_bar, 0, cols - 29, _active);
+    wattroff(status_bar, COLOUR_BAR_DRAW);
+
+    int i;
+    for(i = 0; i < 9; i++) {
+        if (is_new[i])
+            status_bar_new(i+1);
+        else if (is_active[i])
+            status_bar_active(i+1);
+    }
+
     dirty = TRUE;
 }