diff --git a/src/logcat.js b/src/logcat.js index 73e7846..5138925 100644 --- a/src/logcat.js +++ b/src/logcat.js @@ -117,7 +117,7 @@ class LogcatContent { // no point in formatting the data if there are no connected clients var clients = LogcatContent._wss.clients.filter(client => client._logcatid === this._logcatid); if (clients.length) { - var lines = '
' + this._htmllogs.join(os.EOL) + '
'; + var lines = '
' + this._htmllogs.join('') + '
'; clients.forEach(client => client.send(lines)); } // once we've updated all the clients, discard the info diff --git a/src/res/logcat.html b/src/res/logcat.html index 81bb7a6..5c72561 100644 --- a/src/res/logcat.html +++ b/src/res/logcat.html @@ -10,7 +10,7 @@ .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} .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;} .b {flex:0 0 auto;border-bottom: 1px solid rgba(128,128,128,.2); padding-bottom: .2em} .vscode-high-contrast .b {border-color: #0cc} @@ -56,7 +56,7 @@ const setStatus = (x) => { getId('status').textContent = ''+x; } const start = () => { 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) => { if (!rows) return window.getSelection().empty(); var range = document.createRange(); @@ -74,8 +74,17 @@ } }; 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; + setTimeout(updateLogCountDisplay, 1); } showFilterErr = (msg) => { filter.style['border-color'] = 'red'; @@ -151,7 +160,7 @@ if (/^:logcat_cleared$/.test(rawlogs)) { rows.innerHTML = ''; rows.insertAdjacentHTML('afterbegin','
---- log cleared ----
'); - logcount = 0; + logcount = prevlc = 0; if (currfilter) currfilter.matchCounts = {true:0,false:0}; updateLogCountDisplay(); return;