Skip to content

Commit 5027312

Browse files
author
thyttan
committed
messagegui: keep idx info of selected messages in messagesScroller
1 parent 98d7998 commit 5027312

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/messagegui/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ function showMessagesScroller(msg) {
352352
},
353353
select : function(scrollIdx, touch) {
354354
if (touch && touch.type===2) {return;}
355-
const MSG_SELECTED = findSelectedMsg(scrollIdx);
355+
const MSG_SELECTED_IDX = findSelectedMsgIdx(scrollIdx);
356+
const MSG_SELECTED = MESSAGES[MSG_SELECTED_IDX];
356357
WU&&WU.show();
357358

358359
print(process.memory().free);
@@ -411,10 +412,10 @@ function showMessagesScroller(msg) {
411412
//// Helper functions ////
412413

413414
// helper function for message selection
414-
let findSelectedMsg = function(scrollIdx) {
415+
let findSelectedMsgIdx = function(scrollIdx) {
415416
for (let i = firstTitleLinePerMsg.length - 1; i >= 0; i--) {
416417
if (scrollIdx >= firstTitleLinePerMsg[i]) {
417-
return MESSAGES[i];
418+
return i;
418419
}
419420
}
420421
}

0 commit comments

Comments
 (0)