Skip to content

Commit 744cc23

Browse files
author
thyttan
committed
messagegui: tweak updateReadMessages, possibly fixing off by one
1 parent a896cf3 commit 744cc23

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

apps/messagegui/app.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,19 @@ function showMessagesScroller(msg, persist) {
374374

375375
for (let i=0; i<firstTitleLinePerMsg.length-1 ; i++) {
376376

377-
if (shownScrollIdxFirst<=firstTitleLinePerMsg[i] && shownScrollIdxFirst+LINES_PER_SCREEN>firstTitleLinePerMsg[i]) {
377+
if (
378+
shownScrollIdxFirst
379+
<= firstTitleLinePerMsg[i] && firstTitleLinePerMsg[i]
380+
< shownScrollIdxFirst+LINES_PER_SCREEN
381+
) {
378382
shownMsgIdxFirst = i;
379383
}
380384

381-
if (shownScrollIdxLast>=firstTitleLinePerMsg[i+1] && shownScrollIdxLast-LINES_PER_SCREEN<firstTitleLinePerMsg[i+1]) {
385+
if (
386+
shownScrollIdxLast-LINES_PER_SCREEN
387+
< firstTitleLinePerMsg[i+1]-1 && firstTitleLinePerMsg[i+1]-1
388+
<= shownScrollIdxLast
389+
) {
382390
shownMsgIdxLast = i;
383391
//print(i)
384392
}

0 commit comments

Comments
 (0)