about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-12-13 13:13:02 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-12-13 13:13:02 +0100
commit3036834ec83d2433bf5b1b4408776d771554878c (patch)
treebbe9880d98e8d840ee38f0cec12b86465262c057 /src
parente2b44a69bd445e375664c6a3e85146b81fc088ab (diff)
downloadprofani-tty-3036834ec83d2433bf5b1b4408776d771554878c.tar.gz
separator: Enable for MUC and PRIVWIN too
Fix https://github.com/profanity-im/profanity/issues/1238
Diffstat (limited to 'src')
-rw-r--r--src/ui/core.c35
-rw-r--r--src/ui/mucwin.c2
-rw-r--r--src/ui/privwin.c1
3 files changed, 29 insertions, 9 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 6bf43d94..545c508f 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -651,24 +651,41 @@ ui_focus_win(ProfWin *window)
     }
 
     ProfWin *old_current = wins_get_current();
+
     if (old_current->type == WIN_CONFIG) {
         ProfConfWin *confwin = (ProfConfWin*)old_current;
         cmd_ac_remove_form_fields(confwin->form);
     }
-
-    // TODO: if old win is chatwin; and has lastreadline; then remove that line
-    if (old_current->type == WIN_CHAT) {
-        ProfChatWin *chatwin = (ProfChatWin*)old_current;
-        assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
-        //win_update_entry_message_real(old_current, chatwin->barejid, "$$$");
-        win_remove_entry_message(old_current, chatwin->barejid);
-    }
-
     if (window->type == WIN_CONFIG) {
         ProfConfWin *confwin = (ProfConfWin*)window;
         cmd_ac_add_form_fields(confwin->form);
     }
 
+    // check for trackbar last position separator
+    switch (old_current->type)
+    {
+    case WIN_CHAT:
+    {
+        ProfChatWin *chatwin = (ProfChatWin*)old_current;
+        win_remove_entry_message(old_current, chatwin->barejid);
+        break;
+    }
+    case WIN_MUC:
+    {
+        ProfMucWin *mucwin = (ProfMucWin*)old_current;
+        win_remove_entry_message(old_current, mucwin->roomjid);
+        break;
+    }
+    case WIN_PRIVATE:
+    {
+        ProfPrivateWin *privwin = (ProfPrivateWin*)old_current;
+        win_remove_entry_message(old_current, privwin->fulljid);
+        break;
+    }
+    default:
+        break;
+    }
+
     int i = wins_get_num(window);
     wins_set_current_by_num(i);
 
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index f2d1a946..66de0dba 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -551,6 +551,8 @@ mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions,
         ch = prefs_get_omemo_char();
     }
 
+    win_insert_last_read_position_marker((ProfWin*)mucwin, mucwin->roomjid);
+
     if (g_slist_length(mentions) > 0) {
         _mucwin_print_mention(window, message->plain, message->jid->resourcepart, mynick, mentions, &ch, flags);
     } else if (triggers) {
diff --git a/src/ui/privwin.c b/src/ui/privwin.c
index b888041a..4befc325 100644
--- a/src/ui/privwin.c
+++ b/src/ui/privwin.c
@@ -69,6 +69,7 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message)
     } else {
         status_bar_new(num, WIN_PRIVATE, privatewin->fulljid);
         cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread);
+        win_insert_last_read_position_marker((ProfWin*)privatewin, privatewin->fulljid);
         win_print_incoming(window, jidp->resourcepart, message);
 
         privatewin->unread++;