Skip to content

Commit 3c14df9

Browse files
author
thyttan
committed
messagegui: wip small improvements
1 parent 74ccaa7 commit 3c14df9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

apps/messagegui/app.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ function showMessageScroller2(msg, persist, initAtEndOfMsg, alreadyProcessed) {
281281
// alreadyProcessed = { lines : [], startIdx : undefined, stopIdx : undefined };
282282
//}
283283

284+
//msg.new = false;
284285
require("widget_utils").hide();
285286

286287
if (alreadyProcessed) print("alreadyPeocessed start and stop idx: ",alreadyProcessed.startIdx, alreadyProcessed.stopIdx);
@@ -325,6 +326,7 @@ function showMessageScroller2(msg, persist, initAtEndOfMsg, alreadyProcessed) {
325326
var messagesWrapped = [];
326327
for (let j=startIdx; j<stopIdx; j++) {
327328
let msgLocal = MESSAGES[j];
329+
msgLocal.new = false;
328330

329331
if (msgLocal.id=="music" || msgLocal.source=="maps" || msgLocal.id =="call") {
330332
stopIdx++
@@ -341,7 +343,7 @@ function showMessageScroller2(msg, persist, initAtEndOfMsg, alreadyProcessed) {
341343
}
342344
var titleCnt = lines.length;
343345
if (titleCnt) lines.push(""); // add blank line after title
344-
lines = lines.concat(g.wrapString(msgLocal.body, g.getWidth()-10), [ "------" ]);
346+
lines = lines.concat(g.wrapString(msgLocal.body, g.getWidth()-10), [ "---------" ]);
345347
messagesWrapped.push(lines);
346348
//print(lines);
347349
// allLines = allLines.concat(lines);
@@ -361,14 +363,13 @@ function showMessageScroller2(msg, persist, initAtEndOfMsg, alreadyProcessed) {
361363
// }
362364

363365
print("titlelines", titleLines)
364-
var initScroll;
366+
var initScroll = messagesWrapped[0].length;
365367
if (alreadyProcessed===undefined){
366-
initScroll = messagesWrapped[0].length;
368+
if (msgIdx==0) initScroll = 0;
367369
} else if (msgIdx <= alreadyProcessed.startIdx) {
368-
initScroll = messagesWrapped[0].length;
369370
titleLines = titleLines.concat(alreadyProcessed.titleLines.map((x) => x + allLines2.length));
370371
} else if (msgIdx >= alreadyProcessed.stopIdx-1){
371-
initScroll = alreadyProcessed.lines.length-8;
372+
initScroll = alreadyProcessed.lines.length-9;
372373
titleLines = alreadyProcessed.titleLines.concat(titleLines.map((x) => x + alreadyProcessed.lines.length));
373374
}
374375

@@ -724,7 +725,7 @@ function checkMessages(options) {
724725
if (!options.ignoreUnread && newMessages.length) {
725726
delete newMessages[0].show; // stop us getting stuck here if we're called a second time
726727
//showMessage(newMessages[0].id, false);
727-
showMessageScroller2(MESSAGES[2], false, false);
728+
showMessageScroller2(newMessages[0], false, false);
728729
// buzz after showMessage, so being busy during layout doesn't affect the buzz pattern
729730
if (global.BUZZ_ON_NEW_MESSAGE) {
730731
// this is set if we entered the messages app by loading `messagegui.new.js`

0 commit comments

Comments
 (0)