           return
         }
 
-        let startIndex = min(idx * self.chunkSize, count)
-        let endIndex = min(startIndex + self.chunkSize, count)
+        let startIndex = min(idx * chunkSize, count)
+        let endIndex = min(startIndex + chunkSize, count)
 
         let chunkedItems = self.flatFileItems[startIndex..<endIndex]
         let chunkedResult: [ScoredFileItem] = chunkedItems.flatMap {


    let sorted: [ScoredFileItem]
    if pattern.characters.count == 0 {
      let truncatedItems = self.flatFileItems[0...min(self.maxResultCount, self.flatFileItems.count - 1)]
      sorted = truncatedItems.map { ScoredFileItem(score: 0, url: $0.url) }
    } else {
      DispatchQueue.main.async { self.openQuickly.startProgress() }
      defer { DispatchQueue.main.async { self.openQuickly.endProgress() } }

      let count = self.flatFileItems.count
      let chunksCount = Int(ceil(Float(count) / Float(self.chunkSize)))
      let useFullPath = pattern.contains("/")
      let cwdPath = self.cwd.path + "/"



class OpenQuicklyFilterOperation: Operation {

  init(forOpenQuickly openQuickly: OpenQuicklyWindow) {
    self.openQuickly = openQuickly
    self.pattern = openQuickly.pattern
    self.cwd = openQuickly.cwd
    self.flatFileItems = openQuickly.flatFileItems

    super.init()
