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:05:24 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-12-13 12:05:24 +0100
commit14f25992c39cc5e3ec04f3a053f38bee9c77cf4e (patch)
treec61997b4e3db1b96cc2fbbc2e4a6a8a7a30cad2c /src/ui/window.c
parent9bb2d7f95e12b5a2ce6a957c92efaa6a4171e663 (diff)
downloadprofani-tty-14f25992c39cc5e3ec04f3a053f38bee9c77cf4e.tar.gz
Initial work on last-read-position feature
Print dashes on the position we last left off in a chat window.
So far the number of dashes is hardcoded, and the feature only works in
chat windows.

Regards https://github.com/profanity-im/profanity/issues/1238
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 2a76496c..e592aa2e 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1355,6 +1355,13 @@ win_update_entry_message(ProfWin *window, const char *const id, const char *cons
 }
 
 void
+win_remove_entry_message(ProfWin *window, const char *const id)
+{
+    buffer_remove_entry_by_id(window->layout->buffer, id);
+    win_redraw(window);
+}
+
+void
 win_newline(ProfWin *window)
 {
     win_appendln(window, THEME_DEFAULT, "");
@@ -1809,3 +1816,29 @@ win_handle_command_exec_result_note(ProfWin *window, const char *const type, con
     assert(window != NULL);
     win_println(window, THEME_DEFAULT, '!', value);
 }
+
+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);
+    // can we leave this? TODO
+    //    win_print_separator(window);
+    //_win_print(window, '-', 0, time, 0, THEME_TEXT, NULL, "---", NULL);
+    win_redraw(window);
+
+    g_date_time_unref(time);
+}
+