MS Commit

This commit is contained in:
2023-04-24 16:47:22 +02:00
parent 0032ee9941
commit 88791832ec
3 changed files with 59 additions and 49 deletions

View File

@@ -45,14 +45,18 @@ Public Class Search
Public Sub NextHighlight()
' This also applies when the page has *NO* occurrences, so 0 = 0
If _CurrentOccurrenceCount = _CurrentSelectedOccurrence Then
Dim oCount = 0
' If there are no occurrences on the current page, got to the *next page*
While _CurrentOccurrenceCount = _CurrentSelectedOccurrence And _CurrentPage <= _Viewer.PageCount
oCount += 1
If _CurrentPage = _Viewer.PageCount Then
_Viewer.DisplayFirstPage()
Else
_Viewer.DisplayNextPage()
End If
If oCount > 333 Then
Exit While
End If
End While
' Safeguard against selecting a non-existing occurrence on the last page
@@ -69,14 +73,17 @@ Public Class Search
Public Sub PrevHighlight()
If _CurrentOccurrenceCount = 0 Or _CurrentSelectedOccurrence = 1 Then
Dim oCount = 0
While (_CurrentOccurrenceCount = 0 Or _CurrentSelectedOccurrence = 1) And _CurrentPage >= 1
oCount += 1
If _CurrentPage = 1 Then
_Viewer.DisplayLastPage()
Else
_Viewer.DisplayPreviousPage()
End If
If oCount > 333 Then
Exit While
End If
End While
If _CurrentOccurrenceCount > 0 Then