X-Git-Url: https://git.r.bdr.sh/rbdr/map/blobdiff_plain/be897af3bd7cc010c1aa496d5b1faf8a2e1f82ed..ed10ac191df473c92c4fec495aafa7f569d108c8:/Map/Presentation/MapEditor.swift?ds=inline diff --git a/Map/Presentation/MapEditor.swift b/Map/Presentation/MapEditor.swift index d62d4ad..5cda8f9 100644 --- a/Map/Presentation/MapEditor.swift +++ b/Map/Presentation/MapEditor.swift @@ -20,6 +20,8 @@ struct MapEditor: View { @State var selectedEvolution: StageType = .behavior @State var isSearching: Bool = false + private let changeDebouncer: Debouncer = Debouncer(seconds: 0.05) + @AppStorage("viewStyle") var viewStyle: ViewStyle = .horizontal let zoomRange = Constants.kMinZoom...Constants.kMaxZoom @@ -28,9 +30,11 @@ struct MapEditor: View { @State var searchTerm = "" @State var selectedTerm = 0 - var results: [Range] { + @State var results: [Range] = [] + + private func updateRanges() { if !isSearching || searchTerm.isEmpty { - return [] + results = [] } let options: NSString.CompareOptions = [.caseInsensitive, .diacriticInsensitive] var searchRange = document.text.startIndex..