From d5fd7d4989d244f896183f5abb8d409f70fb0ffd Mon Sep 17 00:00:00 2001
From: Thomas Goyne <plorkyeran@aegisub.org>
Date: Wed, 5 Mar 2014 15:26:50 -0800
Subject: [PATCH] Sort the actor and effect fields. Closes #1715.

---
 aegisub/src/subs_edit_box.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp
index 39d59f0cc..3d0a9b761 100644
--- a/aegisub/src/subs_edit_box.cpp
+++ b/aegisub/src/subs_edit_box.cpp
@@ -343,14 +343,20 @@ void SubsEditBox::PopulateList(wxComboBox *combo, boost::flyweight<std::string>
 	wxEventBlocker blocker(this);
 
 	std::unordered_set<std::string> values;
-	for (auto diag : c->ass->Line | agi::of_type<AssDialogue>())
-		values.insert(diag->*field);
-	values.erase("");
+	for (auto const& line : c->ass->Line) {
+		if (line.Group() != AssEntryGroup::DIALOGUE) continue;
+		auto const& value = static_cast<const AssDialogue *>(&line)->*field;
+		if (!value.get().empty())
+			values.insert(value);
+	}
+
 	wxArrayString arrstr;
 	arrstr.reserve(values.size());
 	transform(values.begin(), values.end(), std::back_inserter(arrstr),
 		(wxString (*)(std::string const&))to_wx);
 
+	arrstr.Sort();
+
 	combo->Freeze();
 	long pos = combo->GetInsertionPoint();
 	wxString value = combo->GetValue();
-- 
GitLab