ClientListMgr // Autofill recent 20 clients on adding new clients.
This commit is contained in:
parent
bb991d0c86
commit
1f3fd08cad
|
@ -97,12 +97,20 @@ extension CtlClientListMgr {
|
|||
theTextView.textContainer?.containerSize = NSSize(width: maxFloat, height: maxFloat)
|
||||
theTextView.textContainer?.widthTracksTextView = false
|
||||
|
||||
// 預先填寫近期用過威注音輸入法的客體軟體,最多二十筆。
|
||||
theTextView.textContainer?.textView?.string = {
|
||||
let recentClients = SessionCtl.recentClientBundleIdentifiers.keys.compactMap {
|
||||
PrefMgr.shared.clientsIMKTextInputIncapable.keys.contains($0) ? nil : $0
|
||||
}
|
||||
return recentClients.sorted().joined(separator: "\n")
|
||||
}()
|
||||
|
||||
alert.accessoryView = scrollview
|
||||
alert.beginSheetModal(for: window) { result in
|
||||
switch result {
|
||||
case .alertFirstButtonReturn, .alertSecondButtonReturn:
|
||||
theTextView.textContainer?.textView?.string.components(separatedBy: "\n").filter { !$0.isEmpty }.forEach {
|
||||
self.applyNewValue($0)
|
||||
self.applyNewValue($0, highMitigation: result == .alertFirstButtonReturn)
|
||||
}
|
||||
if result == .alertFirstButtonReturn { break }
|
||||
let dlgOpenPath = NSOpenPanel()
|
||||
|
|
Loading…
Reference in New Issue