6 #include "../../util/debug.h"
7 #include "../helpline.h"
9 #include "../libslang.h"
11 char ui_helpline__last_msg[1024];
12 bool tui_helpline__set;
14 static void tui_helpline__pop(void)
18 static void tui_helpline__push(const char *msg)
20 const size_t sz = sizeof(ui_helpline__current);
22 SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
24 SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
26 strlcpy(ui_helpline__current, msg, sz);
29 static int tui_helpline__show(const char *format, va_list ap)
34 pthread_mutex_lock(&ui__lock);
35 ret = vscnprintf(ui_helpline__last_msg + backlog,
36 sizeof(ui_helpline__last_msg) - backlog, format, ap);
39 tui_helpline__set = true;
41 if (ui_helpline__last_msg[backlog - 1] == '\n') {
42 ui_helpline__puts(ui_helpline__last_msg);
46 pthread_mutex_unlock(&ui__lock);
51 struct ui_helpline tui_helpline_fns = {
52 .pop = tui_helpline__pop,
53 .push = tui_helpline__push,
54 .show = tui_helpline__show,
57 void ui_helpline__init(void)
59 helpline_fns = &tui_helpline_fns;
60 ui_helpline__puts(" ");