Don't show fetch more lines when there aren't any
This commit is contained in:
parent
583a4bab58
commit
ad68e32c08
|
@ -232,9 +232,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
|
||||||
<table ng-class="{'notimestamp':notimestamp}">
|
<table ng-class="{'notimestamp':notimestamp}">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="bufferline">
|
<tr class="bufferline">
|
||||||
<td class="time"><span class="date"> </span></td>
|
<td ng-hide="noMoreLines" colspan="3">
|
||||||
<td class="prefix"> </td>
|
|
||||||
<td class="message">
|
|
||||||
<a class="fetchmorelines" ng-click="fetchMoreLines()" ng-hide="loadingLines">Fetch more lines</a>
|
<a class="fetchmorelines" ng-click="fetchMoreLines()" ng-hide="loadingLines">Fetch more lines</a>
|
||||||
<span ng-show="loadingLines">Fetching more lines...</span>
|
<span ng-show="loadingLines">Fetching more lines...</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -432,6 +432,10 @@ function($rootScope,
|
||||||
var setReadmarker = (buffer.lastSeen >= 0);
|
var setReadmarker = (buffer.lastSeen >= 0);
|
||||||
buffer.lines.length = 0;
|
buffer.lines.length = 0;
|
||||||
buffer.requestedLines = 0;
|
buffer.requestedLines = 0;
|
||||||
|
// Count number of lines recieved
|
||||||
|
var newLength = lineinfo.objects[0].content.length;
|
||||||
|
|
||||||
|
// Parse the lines
|
||||||
handlers.handleLineInfo(lineinfo, true);
|
handlers.handleLineInfo(lineinfo, true);
|
||||||
|
|
||||||
if (setReadmarker) {
|
if (setReadmarker) {
|
||||||
|
@ -444,7 +448,14 @@ function($rootScope,
|
||||||
// the read marker position correct
|
// the read marker position correct
|
||||||
buffer.lastSeen -= oldLength;
|
buffer.lastSeen -= oldLength;
|
||||||
}
|
}
|
||||||
|
// We request more lines, but didn't get more. No more lines!
|
||||||
|
if(oldLength === newLength) {
|
||||||
|
$rootScope.noMoreLines = true;
|
||||||
|
}
|
||||||
|
// We requested more lines than we got, no more lines.
|
||||||
|
if(newLength < numLines) {
|
||||||
|
$rootScope.noMoreLines = true;
|
||||||
|
}
|
||||||
$rootScope.loadingLines = false;
|
$rootScope.loadingLines = false;
|
||||||
// Scroll read marker to the center of the screen
|
// Scroll read marker to the center of the screen
|
||||||
$rootScope.scrollWithBuffer(true);
|
$rootScope.scrollWithBuffer(true);
|
||||||
|
@ -583,6 +594,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$rootScope.$on('activeBufferChanged', function() {
|
$rootScope.$on('activeBufferChanged', function() {
|
||||||
$rootScope.scrollWithBuffer(true);
|
$rootScope.scrollWithBuffer(true);
|
||||||
|
|
||||||
|
// Reset no more lines
|
||||||
|
$rootScope.noMoreLines = false;
|
||||||
|
|
||||||
var ab = models.getActiveBuffer();
|
var ab = models.getActiveBuffer();
|
||||||
if (ab.requestedLines < $scope.lines) {
|
if (ab.requestedLines < $scope.lines) {
|
||||||
// buffer has not been loaded, but some lines may already be present if they arrived after we connected
|
// buffer has not been loaded, but some lines may already be present if they arrived after we connected
|
||||||
|
|
Loading…
Reference in New Issue