|
@@ -8,7 +8,7 @@
|
|
|
import Foundation
|
|
|
|
|
|
extension KMMainViewController {
|
|
|
- func search(searchString: String, isCase: Bool, display: Bool = true) {
|
|
|
+ func search(searchString: String, isCase: Bool, display: Bool = true, needShowAll: Bool = false) {
|
|
|
let document = self.listView.document
|
|
|
if let data = document?.isFinding, data {
|
|
|
document?.cancelFindString()
|
|
@@ -52,7 +52,9 @@ extension KMMainViewController {
|
|
|
// self.listView.setHighlightedSelections(selections )
|
|
|
}
|
|
|
|
|
|
- self.listView.setHighlightedSelections(_selections)
|
|
|
+ if needShowAll {
|
|
|
+ self.listView.setHighlightedSelections(_selections)
|
|
|
+ }
|
|
|
if _selections.isEmpty {
|
|
|
self.listView.setHighlightedSelection(nil, animated: false)
|
|
|
}
|
|
@@ -4808,6 +4810,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
|
}
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, searchAction searchString: String, forward: Bool) {
|
|
|
+ self.leftSideViewController.showSearchMode(searchString)
|
|
|
// if self.searchResults.count == 0 {
|
|
|
let caseInsensitive = UserDefaults.standard.bool(forKey: "SKCaseInsensitiveFindKey")
|
|
|
self.search(searchString: searchString, isCase: !caseInsensitive, display: false)
|
|
@@ -4820,6 +4823,7 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
|
if row >= 0 && row < self.searchResults.count && self.searchResults.count != 0 {
|
|
|
let model = self.searchResults[row]
|
|
|
if model.selection != nil {
|
|
|
+ self.listView.setHighlightedSelections([])
|
|
|
self.listView.go(to: model.selection, animated: true)
|
|
|
self.listView.setHighlightedSelection(model.selection, animated: true)
|
|
|
self.listView.setNeedsDisplayAnnotationViewForVisiblePages()
|
|
@@ -4827,13 +4831,13 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
|
|
|
searchIndex = row
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- self.leftSideViewController.showSearchMode(searchString)
|
|
|
}
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, searchAllAction searchString: String, forward: Bool) {
|
|
|
// if self.searchResults.count == 0 {
|
|
|
self.leftSideViewController.showSearchMode(searchString)
|
|
|
+ let caseInsensitive = UserDefaults.standard.bool(forKey: "SKCaseInsensitiveFindKey")
|
|
|
+ self.search(searchString: searchString, isCase: !caseInsensitive, display: false, needShowAll: true)
|
|
|
// }
|
|
|
|
|
|
// var row = max(searchIndex - 1, 0)
|