修复不连续多选删除错误问题
This commit is contained in:
@ -131,12 +131,14 @@ class PreferencesWindowController: NSWindowController
|
|||||||
|
|
||||||
@IBAction func removeProfile(_ sender: NSButton) {
|
@IBAction func removeProfile(_ sender: NSButton) {
|
||||||
let index = Int(profilesTableView.selectedRowIndexes.first!)
|
let index = Int(profilesTableView.selectedRowIndexes.first!)
|
||||||
|
var deleteCount = 0
|
||||||
if index >= 0 {
|
if index >= 0 {
|
||||||
profilesTableView.beginUpdates()
|
profilesTableView.beginUpdates()
|
||||||
for (_, _) in profilesTableView.selectedRowIndexes.enumerated() {
|
for (_, toDeleteIndex) in profilesTableView.selectedRowIndexes.enumerated() {
|
||||||
print(profileMgr.profiles.count)
|
print(profileMgr.profiles.count)
|
||||||
profileMgr.profiles.remove(at: index)
|
profileMgr.profiles.remove(at: toDeleteIndex - deleteCount)
|
||||||
profilesTableView.removeRows(at: IndexSet(integer: index), withAnimation: .effectFade)
|
profilesTableView.removeRows(at: IndexSet(integer: toDeleteIndex - deleteCount), withAnimation: .effectFade)
|
||||||
|
deleteCount += 1
|
||||||
}
|
}
|
||||||
profilesTableView.endUpdates()
|
profilesTableView.endUpdates()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user