about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-10-12 00:14:55 +0100
committerJames Booth <boothj5@gmail.com>2016-10-12 00:14:55 +0100
commit97898ee082d314eb6d7f27a0b0d33027defc9a32 (patch)
tree4facff913f030a2a348cf8f0ac108637f12876bb /src
parent7b31af30609e7045a1f6b39668d7abedfb1755da (diff)
downloadprofani-tty-97898ee082d314eb6d7f27a0b0d33027defc9a32.tar.gz
Add win_printf_line
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_funcs.c4
-rw-r--r--src/ui/ui.h1
-rw-r--r--src/ui/window.c21
3 files changed, 23 insertions, 3 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 0117029b..7d4f0064 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -1479,9 +1479,9 @@ _cmd_help_cmd_list(const char *const tag)
     cons_show("");
     ProfWin *console = wins_get_console();
     if (tag) {
-        win_printf(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "%s commands", tag);
+        win_printf_line(console, THEME_WHITE_BOLD, "%s commands", tag);
     } else {
-        win_printf(console, '-', 0, NULL, 0, THEME_WHITE_BOLD, "", "All commands");
+        win_printf_line(console, THEME_WHITE_BOLD, "All commands");
     }
 
     GList *ordered_commands = NULL;
diff --git a/src/ui/ui.h b/src/ui/ui.h
index d7ea0e96..9ba7e65c 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -359,6 +359,7 @@ void win_refresh_without_subwin(ProfWin *window);
 void win_refresh_with_subwin(ProfWin *window);
 void win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags,
     theme_item_t theme_item, const char *const from, const char *const message, ...);
+void win_printf_line(ProfWin *window, theme_item_t theme_item, const char *const message, ...);
 char* win_get_title(ProfWin *window);
 void win_show_occupant(ProfWin *window, Occupant *occupant);
 void win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupant);
diff --git a/src/ui/window.c b/src/ui/window.c
index 81ecb3cd..133a3990 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1030,7 +1030,26 @@ win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim
     buffer_push(window->layout->buffer, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str, NULL);
 
     _win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str, NULL);
-    // TODO: cross-reference.. this should be replaced by a real event-based system
+    inp_nonblocking(TRUE);
+    g_date_time_unref(timestamp);
+
+    g_string_free(fmt_msg, TRUE);
+    va_end(arg);
+}
+
+void
+win_printf_line(ProfWin *window, theme_item_t theme_item, const char *const message, ...)
+{
+    GDateTime *timestamp = g_date_time_new_now_local();
+
+    va_list arg;
+    va_start(arg, message);
+    GString *fmt_msg = g_string_new(NULL);
+    g_string_vprintf(fmt_msg, message, arg);
+
+    buffer_push(window->layout->buffer, '-', 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
+
+    _win_print(window, '-', 0, timestamp, 0, theme_item, "", fmt_msg->str, NULL);
     inp_nonblocking(TRUE);
     g_date_time_unref(timestamp);