fix: preserve full language rows when filtering picker

This commit is contained in:
2026-10-18 18:13:56 +02:00
parent fa3591adf8
commit cead6d9382
3 changed files with 28 additions and 1 deletions
@@ -43,6 +43,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
private var currentLanguage: String?
private var languageTable: NSTableView?
private var languageScroll: NSScrollView?
private var languageViewportHeight: NSLayoutConstraint?
var closed: (() -> Void)?
var isShown: Bool { viewIfLoaded?.superview != nil && !isClosing }
@@ -59,6 +60,7 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
rowTopConstraints = []
languageTable = nil
languageScroll = nil
languageViewportHeight = nil
entries = [
ActionEntry(title: "Open", symbol: "arrow.up.forward.app", color: SunsetPalette.text),
ActionEntry(title: "Favorite", symbol: "star", color: SunsetPalette.text),
@@ -155,7 +157,9 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
])
content.layer?.borderColor = SunsetPalette.secondaryText.withAlphaComponent(0.22).cgColor
if languages != nil {
height.isActive = false
let table = NSTableView()
table.style = .plain
table.addTableColumn(NSTableColumn(identifier: NSUserInterfaceItemIdentifier("Language")))
table.headerView = nil
table.backgroundColor = .clear
@@ -177,14 +181,17 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
scroll.drawsBackground = false
scroll.translatesAutoresizingMaskIntoConstraints = false
content.addSubview(scroll)
let viewportHeight = scroll.heightAnchor.constraint(equalToConstant: LauncherRowView.rowHeight)
NSLayoutConstraint.activate([
scroll.leadingAnchor.constraint(equalTo: content.leadingAnchor, constant: 8),
scroll.trailingAnchor.constraint(equalTo: content.trailingAnchor, constant: -8),
scroll.topAnchor.constraint(equalTo: applicationLabel.bottomAnchor, constant: 10),
scroll.bottomAnchor.constraint(equalTo: search.topAnchor, constant: -8),
viewportHeight,
])
languageTable = table
languageScroll = scroll
languageViewportHeight = viewportHeight
}
updateSelection()
}
@@ -345,9 +352,10 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
let selection = (query.isEmpty ? matchingLanguages.firstIndex(where: { $0.code == currentLanguage }) : nil)
?? (matchingLanguages.isEmpty ? nil : 0)
for entry in entries { entry.view.isHidden = true }
heightConstraint?.constant = 116 + CGFloat(max(min(matchingLanguages.count, 6), 1) - 1) * LauncherRowView.rowHeight
languageViewportHeight?.constant = CGFloat(max(min(matchingLanguages.count, 6), 1)) * table.rowHeight
empty.isHidden = !matchingLanguages.isEmpty
languageScroll?.isHidden = matchingLanguages.isEmpty
view.superview?.layoutSubtreeIfNeeded()
table.reloadData()
selectedEntry = selection
if let selectedEntry {