Skip to content

Commit 764e374

Browse files
author
thyttan
committed
messagegui: use obj param for alrdy procd lines
1 parent 2d0e03b commit 764e374

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

apps/messagegui/app.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,14 @@ function showMessageScroller(msg) {
274274
});
275275
}
276276

277-
function showMessageScroller2(msg, initAtEndOfMsg, persist, alreadyProcessedLines, alreadyProcessedIdx) {
277+
function showMessageScroller2(msg, initAtEndOfMsg, persist, alreadyProcessed) {
278278
if (initAtEndOfMsg===undefined) {initAtEndOfMsg = false;}
279279
if (persist===undefined) {persist = true;}
280-
if (!!alreadyProcessedLines) {alreadyProcessedLines = [];}
281-
if (!!alreadyProcessedIdx) {alreadyProcessedIdx = [];}
280+
if (!!alreadyProcessed) {
281+
alreadyProcessed = {};
282+
alreadyProcessed.lines = [];
283+
alreadyProcessed.idxSpan = [];
284+
}
282285

283286
if (replying) { return; }
284287
if (persist) {
@@ -292,10 +295,10 @@ function showMessageScroller2(msg, initAtEndOfMsg, persist, alreadyProcessedLine
292295
let startIdx;
293296
let stopIdx;
294297

295-
if (alreadyProcessedIdx.length===0){
298+
if (alreadyProcessed.idxSpan.length===0){
296299
startIdx = Math.max(msgIdx-1, 0);
297300
stopIdx = Math.min(msgIdx+2, MESSAGES.length);
298-
} else if (msgIdx > alreadyProcessedIdx[0] && msgid < alreadyProcessedIdx[1]){
301+
} else if (msgIdx > alreadyProcessed.idxSpan[0] && msgid < alreadyProcessed.idxSpan[1]){
299302
startIdx = msgIdx;
300303
stopIdx = msgIdx+1;
301304
} else {
@@ -346,7 +349,7 @@ function showMessageScroller2(msg, initAtEndOfMsg, persist, alreadyProcessedLine
346349
initScroll += messagesWrapped[i].length>8?messagesWrapped[i].length-8:0;
347350
}
348351

349-
if (allLines2.length == 0 && alreadyProcessedIdx.length == 0) {
352+
if (allLines2.length == 0 && alreadyProcessed.idxSpan.length == 0) {
350353
cancelReloadTimeout();
351354
returnToClockIfEmpty();
352355
}

0 commit comments

Comments
 (0)