From f356cd2d5c3bf741e0762caf255c06bc4c86eafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=AE=87=E8=88=AA?= Date: Sat, 15 Apr 2017 09:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E5=8F=AF=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowsocksX-NG/PreferencesWindowController.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ShadowsocksX-NG/PreferencesWindowController.swift b/ShadowsocksX-NG/PreferencesWindowController.swift index 9cb0ddb..5957831 100644 --- a/ShadowsocksX-NG/PreferencesWindowController.swift +++ b/ShadowsocksX-NG/PreferencesWindowController.swift @@ -107,6 +107,7 @@ class PreferencesWindowController: NSWindowController override func awakeFromNib() { profilesTableView.register(forDraggedTypes: [tableViewDragType]) + profilesTableView.allowsMultipleSelection = true } @IBAction func addProfile(_ sender: NSButton) { @@ -129,11 +130,14 @@ class PreferencesWindowController: NSWindowController } @IBAction func removeProfile(_ sender: NSButton) { - let index = profilesTableView.selectedRow + let index = Int(profilesTableView.selectedRowIndexes.first!) if index >= 0 { profilesTableView.beginUpdates() - profileMgr.profiles.remove(at: index) - profilesTableView.removeRows(at: IndexSet(integer: index), withAnimation: .effectFade) + for (_, _) in profilesTableView.selectedRowIndexes.enumerated() { + print(profileMgr.profiles.count) + profileMgr.profiles.remove(at: index) + profilesTableView.removeRows(at: IndexSet(integer: index), withAnimation: .effectFade) + } profilesTableView.endUpdates() } updateProfileBoxVisible()