[polari/gnome-3-20] chatView: Re-enable auto-scrolling after reading mention at bottom



commit 2903c6ade78468d424f2a87efe65b50788a19314
Author: Florian MĂźllner <fmuellner gnome org>
Date:   Sun Jul 10 16:27:55 2016 +0200

    chatView: Re-enable auto-scrolling after reading mention at bottom
    
    We stop auto-scrolling when a message is highlighted, to keep it
    visible on screen. However once the message has been read (e.g.
    by switching to the room in question), it makes sense to turn
    auto-scrolling back on if the message is at the end of the buffer,
    as the view is already scrolled to the bottom in this case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765129

 src/chatView.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 38e4339..4bbed3b 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -644,8 +644,13 @@ const ChatView = new Lang.Class({
 
     _pendingMessageRemoved: function(channel, message) {
         let [id,] = message.get_pending_message_id();
-        if (this._pending[id])
-            this._view.buffer.delete_mark(this._pending[id]);
+        let mark = this._pending[id];
+        if (!mark)
+            return;
+        // Re-enable auto-scrolling if this is the most recent message
+        if (this._view.buffer.get_iter_at_mark(mark).is_end())
+            this._autoscroll = true;
+        this._view.buffer.delete_mark(mark);
         this._app.withdraw_notification('pending-message-' + id);
         delete this._pending[id];
     },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]