Fix logcat lines issue and added count up display.

This commit is contained in:
adelphes
2017-02-05 23:28:02 +00:00
parent cc02c1b089
commit 101611841f
2 changed files with 14 additions and 5 deletions

View File

@@ -117,7 +117,7 @@ class LogcatContent {
// no point in formatting the data if there are no connected clients // no point in formatting the data if there are no connected clients
var clients = LogcatContent._wss.clients.filter(client => client._logcatid === this._logcatid); var clients = LogcatContent._wss.clients.filter(client => client._logcatid === this._logcatid);
if (clients.length) { if (clients.length) {
var lines = '<div class="logblock">' + this._htmllogs.join(os.EOL) + '</div>'; var lines = '<div class="logblock">' + this._htmllogs.join('') + '</div>';
clients.forEach(client => client.send(lines)); clients.forEach(client => client.send(lines));
} }
// once we've updated all the clients, discard the info // once we've updated all the clients, discard the info

View File

@@ -10,7 +10,7 @@
.E {color:#f88} .vscode-light .E {color:#f55} .vscode-high-contrast .E {color:#f00} .E {color:#f88} .vscode-light .E {color:#f55} .vscode-high-contrast .E {color:#f00}
.F {color:#f66} .vscode-light .F {color:#f00} .vscode-high-contrast .F {color:#f00} .F {color:#f66} .vscode-light .F {color:#f00} .vscode-high-contrast .F {color:#f00}
.hide {display:none} .hide {display:none}
.logblock {display:inline-block} .logblock {display:block}
.a {display:flex;flex-direction:column;position:absolute;top:0;bottom:0;left:0;right:0;} .a {display:flex;flex-direction:column;position:absolute;top:0;bottom:0;left:0;right:0;}
.b {flex:0 0 auto;border-bottom: 1px solid rgba(128,128,128,.2); padding-bottom: .2em} .b {flex:0 0 auto;border-bottom: 1px solid rgba(128,128,128,.2); padding-bottom: .2em}
.vscode-high-contrast .b {border-color: #0cc} .vscode-high-contrast .b {border-color: #0cc}
@@ -56,7 +56,7 @@
const setStatus = (x) => { getId('status').textContent = ''+x; } const setStatus = (x) => { getId('status').textContent = ''+x; }
const start = () => { const start = () => {
var rows = getId('rows'), filter = getId('q'); var rows = getId('rows'), filter = getId('q');
var last_known_scroll_position=0, selectall=0, logcount=0, currfilter,ws; var last_known_scroll_position=0, selectall=0, logcount=0, prevlc=0, currfilter,ws;
var selecttext = (rows) => { var selecttext = (rows) => {
if (!rows) return window.getSelection().empty(); if (!rows) return window.getSelection().empty();
var range = document.createRange(); var range = document.createRange();
@@ -74,8 +74,17 @@
} }
}; };
updateLogCountDisplay = () => { updateLogCountDisplay = () => {
var msg = currfilter ? `${currfilter.matchCounts.true}/${logcount}` : logcount var diff = logcount - prevlc;
if (diff <= 0 || diff > 100) {
prevlc = logcount;
var msg = currfilter ? `${currfilter.matchCounts.true}/${logcount}` : logcount;
getId('lcount').textContent = msg;
return;
}
prevlc++;
var msg = currfilter ? `${currfilter.matchCounts.true}/${prevlc}` : prevlc;
getId('lcount').textContent = msg; getId('lcount').textContent = msg;
setTimeout(updateLogCountDisplay, 1);
} }
showFilterErr = (msg) => { showFilterErr = (msg) => {
filter.style['border-color'] = 'red'; filter.style['border-color'] = 'red';
@@ -151,7 +160,7 @@
if (/^:logcat_cleared$/.test(rawlogs)) { if (/^:logcat_cleared$/.test(rawlogs)) {
rows.innerHTML = ''; rows.innerHTML = '';
rows.insertAdjacentHTML('afterbegin','<div>---- log cleared ----</div>'); rows.insertAdjacentHTML('afterbegin','<div>---- log cleared ----</div>');
logcount = 0; logcount = prevlc = 0;
if (currfilter) currfilter.matchCounts = {true:0,false:0}; if (currfilter) currfilter.matchCounts = {true:0,false:0};
updateLogCountDisplay(); updateLogCountDisplay();
return; return;