From 40716ca64903676789621f4cf17d6c2c15408fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 10 Feb 2014 19:24:10 +0000 Subject: [PATCH] Fix issue with incorrect read marker on startup --- js/glowingbear.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/glowingbear.js b/js/glowingbear.js index d63dde5..a4d6ae4 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -390,7 +390,14 @@ function($rootScope, buffer.lines.length = 0; buffer.requestedLines = 0; handlers.handleLineInfo(lineinfo, false, true); - buffer.lastSeen = buffer.lines.length - oldLength - 1; + if (oldLength > 0) { + // We're not initially loading lines into the buffer. + // Set the read marker to the beginning of the newly loaded lines + buffer.lastSeen = buffer.lines.length - oldLength - 1; + } else { + // Initial buffer open, set correct read marker position + buffer.lastSeen += buffer.lines.length; + } $rootScope.loadingLines = false; $rootScope.scrollWithBuffer(true); });