mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-26 23:36:08 +03:00
wip
This commit is contained in:
parent
e3374e0587
commit
354aa7e5cb
@ -56,10 +56,25 @@ class OpenQuicklyWindow: NSObject,
|
||||
self.cwd = state.openQuickly.cwd
|
||||
self.cwdPathCompsCount = self.cwd.pathComponents.count
|
||||
self.cwdControl.url = self.cwd
|
||||
self.currentFileService = self.fileServicesPerRootUrl[self.cwd]
|
||||
|
||||
self.searchStream
|
||||
.observeOn(MainScheduler.instance)
|
||||
.subscribe(onNext: { pattern in
|
||||
self.pattern = pattern
|
||||
guard pattern.count >= 2 else {return }
|
||||
|
||||
self.currentFileService?.stopScanScore()
|
||||
self.scanToken = Token()
|
||||
let localToken = self.scanToken
|
||||
|
||||
self.fileViewItems.removeAll()
|
||||
self.currentFileService?.scanScore(for: pattern) { scoredUrls in
|
||||
DispatchQueue.main.async {
|
||||
guard localToken == self.scanToken else { return }
|
||||
self.fileViewItems.append(contentsOf: scoredUrls)
|
||||
}
|
||||
}
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
|
||||
@ -81,13 +96,15 @@ class OpenQuicklyWindow: NSObject,
|
||||
|
||||
private(set) var cwd = FileUtils.userHomeUrl
|
||||
private var cwdPathCompsCount = 0
|
||||
private var currentFileService: FileService?
|
||||
private var scanToken = Token()
|
||||
|
||||
private var fileServicesPerRootUrl: [URL: FileService] = [:]
|
||||
private var rootUrls: Set<URL> { Set(self.fileServicesPerRootUrl.map { url, _ in url }) }
|
||||
|
||||
// FIXME: migrate to State later...
|
||||
private(set) var pattern = ""
|
||||
@objc private(set) var fileViewItems = [ScoredUrl]()
|
||||
@objc dynamic private(set) var fileViewItems = [ScoredUrl]()
|
||||
private var count = 0
|
||||
private let fileViewItemsController = NSArrayController()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user