File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -373,16 +373,25 @@ function showMessagesScroller(msg, persist) {
373373 //print(shownIdxFirst, shownIdxLast)
374374
375375 for ( let i = 0 ; i < firstTitleLinePerMsg . length - 1 ; i ++ ) {
376-
377- if ( shownScrollIdxFirst <= firstTitleLinePerMsg [ i ] && shownScrollIdxFirst + LINES_PER_SCREEN > firstTitleLinePerMsg [ i ] ) {
376+ const FIRST_LINE_OF_MSG = firstTitleLinePerMsg [ i ] ;
377+ const LAST_LINE_OF_MSG = firstTitleLinePerMsg [ i + 1 ] - 1 ;
378+
379+ if (
380+ shownScrollIdxFirst
381+ <= FIRST_LINE_OF_MSG && FIRST_LINE_OF_MSG
382+ < shownScrollIdxFirst + LINES_PER_SCREEN
383+ ) {
378384 shownMsgIdxFirst = i ;
379385 }
380386
381- if ( shownScrollIdxLast >= firstTitleLinePerMsg [ i + 1 ] && shownScrollIdxLast - LINES_PER_SCREEN < firstTitleLinePerMsg [ i + 1 ] ) {
387+ if (
388+ shownScrollIdxLast - LINES_PER_SCREEN
389+ < LAST_LINE_OF_MSG && LAST_LINE_OF_MSG
390+ <= shownScrollIdxLast
391+ ) {
382392 shownMsgIdxLast = i ;
383393 //print(i)
384394 }
385-
386395 }
387396 if ( shownScrollIdxLast === allLines . length - 1 ) { shownMsgIdxLast = MESSAGES . length - 1 ; }
388397
You can’t perform that action at this time.
0 commit comments