|
|
@@ -1,7 +1,8 @@
|
|
|
let logSource = null;
|
|
|
let currentUnit = null;
|
|
|
|
|
|
-const MAX_LOG_LINES = 2000;
|
|
|
+const MAX_LOG_LINES = 800;
|
|
|
+const MIN_LOG_LINES = 500;
|
|
|
let logLines = [];
|
|
|
|
|
|
function escapeHtml(s) {
|
|
|
@@ -75,12 +76,14 @@ function connectLog(unit, target) {
|
|
|
const line = document.createElement("div");
|
|
|
line.innerHTML = colorLog(e.data);
|
|
|
|
|
|
- const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 2;
|
|
|
+ const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 20;
|
|
|
|
|
|
el.appendChild(line);
|
|
|
|
|
|
- while (el.childElementCount > MAX_LOG_LINES) {
|
|
|
- el.removeChild(el.firstElementChild);
|
|
|
+ if (el.childElementCount > MAX_LOG_LINES) {
|
|
|
+ while (el.childElementCount > MIN_LOG_LINES) {
|
|
|
+ el.firstElementChild.remove();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (atBottom) {
|