about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-12-13 12:19:07 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-12-13 12:19:07 +0100
commita1ed37953cfcfb81533f90e68e0c388ff2def788 (patch)
tree5987ec32c22b9355659f0b5ee133cf1fb4ce70d9 /src/ui/window.c
parent14f25992c39cc5e3ec04f3a053f38bee9c77cf4e (diff)
downloadprofani-tty-a1ed37953cfcfb81533f90e68e0c388ff2def788.tar.gz
separator: print trackbar across the whole line
Use the whole line.
We do this in win_redraw() so upon terminal size change it still
matches.

Regards https://github.com/profanity-im/profanity/issues/1238
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index e592aa2e..28c76348 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1651,6 +1651,18 @@ _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pa
 }
 
 void
+win_print_separator(ProfWin *window)
+{
+    int cols = getmaxx(window->layout->win);
+
+    int i;
+    for (i=1; i<cols; i++) {
+        wprintw(window->layout->win, "-");
+    }
+    wprintw(window->layout->win, "\n");
+}
+
+void
 win_redraw(ProfWin *window)
 {
     int i, size;
@@ -1659,7 +1671,12 @@ win_redraw(ProfWin *window)
 
     for (i = 0; i < size; i++) {
         ProfBuffEntry *e = buffer_get_entry(window->layout->buffer, i);
-        _win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt);
+
+        if (e->from == NULL && e->message && e->message[0] == '-') {
+            win_print_separator(window);
+        } else {
+            _win_print(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->from, e->message, e->receipt);
+        }
     }
 }
 
@@ -1818,22 +1835,11 @@ win_handle_command_exec_result_note(ProfWin *window, const char *const type, con
 }
 
 void
-win_print_separator(ProfWin *window)
-{
-    int cols = getmaxx(window->layout->win);
-
-    int i;
-    for (i=1; i<cols; i++) {
-        wprintw(window->layout->win, "-");
-    }
-}
-
-void
 win_insert_last_read_position_marker(ProfWin *window, char* id)
 {
     GDateTime *time = g_date_time_new_now_local();
 
-    buffer_append(window->layout->buffer, ' ', 0, time, 0, THEME_TEXT, NULL, "-----", NULL, id);
+    buffer_append(window->layout->buffer, ' ', 0, time, 0, THEME_TEXT, NULL, "-", NULL, id);
     // can we leave this? TODO
     //    win_print_separator(window);
     //_win_print(window, '-', 0, time, 0, THEME_TEXT, NULL, "---", NULL);