[polari] chatView: Re-enable auto-scrolling after reading mention at bottom



commit 475d5a35469b6816f04e855ca9e83ce313d2b9df
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 50ecf98..309bfc2 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -671,8 +671,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]