[polari] chatView: Don't autoscroll to bottom while reading backlog
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatView: Don't autoscroll to bottom while reading backlog
- Date: Sat, 12 Oct 2013 20:46:44 +0000 (UTC)
commit d8dd41ec6767edb714219b90a72f34b079c78e7b
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Oct 11 01:36:11 2013 +0200
chatView: Don't autoscroll to bottom while reading backlog
Scrolling automatically to the bottom as new messages arrive is
generally what we want, but it is a horrible disruption when it
kicks in while the user chose to scroll up to read up on previous
messages. To fix, only autoscroll while we are scrolled to the
bottom and keep the current scroll position otherwise.
src/chatView.js | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index a2fd3ac..bcb5bed 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -70,6 +70,9 @@ const ChatView = new Lang.Class({
this._hoveringLink = false;
this._pending = [];
+ let adj = this.widget.vadjustment;
+ this._scrollBottom = adj.upper - adj.page_size;
+
let app = Gio.Application.get_default();
app.pasteManager.addWidget(this._view);
@@ -264,10 +267,14 @@ const ChatView = new Lang.Class({
},
_updateScroll: function() {
- if (this._pending.length == 0)
- this.widget.vadjustment.value = this.widget.vadjustment.upper;
- else if (!this._active)
+ let adj = this.widget.vadjustment;
+ if (this._pending.length == 0) {
+ if (adj.value == this._scrollBottom)
+ adj.value = adj.upper - adj.page_size;
+ } else if (!this._active) {
this._view.scroll_mark_onscreen(this._pending[0].mark);
+ }
+ this._scrollBottom = adj.upper - adj.page_size;
},
_pendingMessageRemoved: function(channel, message) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]