diff --git a/index.html b/index.html
index a7d0234..fe10c2e 100644
--- a/index.html
+++ b/index.html
@@ -78,11 +78,6 @@
-
@@ -250,6 +245,16 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
+
+
+
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 1a614db..d63dde5 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -286,16 +286,6 @@ function($rootScope,
});
// Send all the other commands required for initialization
- ngWebsockets.send(
- weeChat.Protocol.formatHdata({
- path: "buffer:gui_buffers(*)/own_lines/last_line(-"+storage.get('lines')+")/data",
- keys: []
- })
- ).then(function(lineinfo) {
- handlers.handleLineInfo(lineinfo);
- $rootScope.scrollWithBuffer(true);
- });
-
ngWebsockets.send(
weeChat.Protocol.formatHdata({
path: "hotlist:gui_hotlist(*)",
@@ -384,11 +374,9 @@ function($rootScope,
}));
};
- var getMoreLines = function(numLines) {
+ var fetchMoreLines = function(numLines) {
var buffer = models.getActiveBuffer();
- if (numLines === undefined) {
- var numLines = Math.max(40, buffer.requestedLines * 2);
- }
+ numLines = Math.max(numLines, buffer.requestedLines * 2);
$rootScope.loadingLines = true;
ngWebsockets.send(
@@ -415,7 +403,7 @@ function($rootScope,
disconnect: disconnect,
sendMessage: sendMessage,
sendCoreCommand: sendCoreCommand,
- getMoreLines: getMoreLines
+ fetchMoreLines: fetchMoreLines
};
}]);
@@ -476,6 +464,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.scrollWithBuffer(true);
var ab = models.getActiveBuffer();
+ if (ab.requestedLines < $scope.lines) {
+ // buffer has not been loaded
+ // some messages may be present if they arrived after we connected
+ $scope.fetchMoreLines($scope.lines);
+ }
$rootScope.pageTitle = ab.shortName + ' | ' + ab.title;
// If user wants to sync hotlist with weechat
@@ -591,8 +584,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
};
$rootScope.loadingLines = false;
- $scope.fetchMoreLines = function(numLines) {
- connection.getMoreLines(numLines);
+ $scope.fetchMoreLines = function() {
+ connection.fetchMoreLines($scope.lines);
}
$rootScope.scrollWithBuffer = function(nonIncremental) {