Only scroll when at the bottom of the buffer
I think this behaviour is a lot more natural. Because it no longer "scrolls to bottom", I also renamed it.
This commit is contained in:
parent
797be76c95
commit
fe0c070a6c
1 changed files with 4 additions and 4 deletions
|
@ -35,7 +35,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer.active) {
|
if (buffer.active) {
|
||||||
$rootScope.scrollToBottom();
|
$rootScope.scrollWithBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initial && !buffer.active) {
|
if (!initial && !buffer.active) {
|
||||||
|
@ -480,7 +480,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.$on('activeBufferChanged', function() {
|
$rootScope.$on('activeBufferChanged', function() {
|
||||||
$rootScope.scrollToBottom();
|
$rootScope.scrollWithBuffer();
|
||||||
|
|
||||||
var ab = models.getActiveBuffer();
|
var ab = models.getActiveBuffer();
|
||||||
$rootScope.pageTitle = ab.shortName + ' | ' + ab.title;
|
$rootScope.pageTitle = ab.shortName + ' | ' + ab.title;
|
||||||
|
@ -577,13 +577,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.scrollToBottom = function() {
|
$rootScope.scrollWithBuffer = function() {
|
||||||
// FIXME doesn't work if the settimeout runs without a short delay
|
// FIXME doesn't work if the settimeout runs without a short delay
|
||||||
var scroll = function() {
|
var scroll = function() {
|
||||||
var bl = document.getElementById('bufferlines');
|
var bl = document.getElementById('bufferlines');
|
||||||
var sTop = bl.scrollTop;
|
var sTop = bl.scrollTop;
|
||||||
var sVal = bl.scrollHeight - bl.clientHeight;
|
var sVal = bl.scrollHeight - bl.clientHeight;
|
||||||
if(sTop < sVal) {
|
if(sTop == sVal) {
|
||||||
bl.scrollTop = sVal;
|
bl.scrollTop = sVal;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue