diff --git a/src/ProgramTableViewCell.swift b/src/ProgramTableViewCell.swift index a6334a3..2b90633 100644 --- a/src/ProgramTableViewCell.swift +++ b/src/ProgramTableViewCell.swift @@ -3,7 +3,7 @@ import AppKit class ProgramTableRowView: NSTableRowView { override func drawSelection(in dirtyRect: NSRect) { if self.selectionHighlightStyle != .none { - let selectionColor = NSColor.systemBlue + let selectionColor = NSColor.controlAccentColor selectionColor.setFill() self.bounds.fill() } diff --git a/src/SearchViewController.swift b/src/SearchViewController.swift index 366703b..b4c3c3e 100644 --- a/src/SearchViewController.swift +++ b/src/SearchViewController.swift @@ -311,10 +311,7 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, programsTableView.scrollRowToVisible(programsTableViewSelection) if programsList.count > 0 { - let program = programsList[0] - let url = URL(fileURLWithPath: program.path) - .appendingPathComponent(program.name+program.ext) - appIconImage.image = NSWorkspace.shared.icon(forFile: url.path) + appIconImage.image = programsList[0].img } else { appIconImage.image = NSWorkspace.shared.icon(forFile: Bundle.main.bundlePath) @@ -370,7 +367,18 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, // PERF: This is very slow, even with 10 items on the list! It has // to be the image of concern. UIKit has reusable cells, // is that possible? Or is fetching an image is slow? - cell.titleField.stringValue = program.name + program.ext + // searchInput.stringValue + + let app = program.name + program.ext + let rangeToHighlight = + (app.lowercased() as NSString) + .range(of: searchInput.stringValue.lowercased()) + let attributedString = NSMutableAttributedString(string: app) + attributedString.addAttributes( + [.backgroundColor: NSColor.systemOrange], + range: rangeToHighlight) + + cell.titleField.attributedStringValue = attributedString cell.progPathLabel.stringValue = program.path cell.appIconImage.image = program.img cell.id = row