Attached patch sorts listings inset params, and hence solves bug 3639.
Please somebody review and apply the patch.

I could also sort the listings_param_table[] entries manually, but I find
this way easier (and more guaranteed).

regards,

ugras
Index: insets/InsetListingsParams.cpp
===================================================================
--- insets/InsetListingsParams.cpp	(revision 18515)
+++ insets/InsetListingsParams.cpp	(working copy)
@@ -283,22 +283,29 @@
 parValidator::parValidator(string const & n)
 	: name(n), info(0)
 {
+	std::list<std::string> parlist;
+	std::list<string>::iterator pariter;
+	size_t idx = 0;
+	while (listings_param_table[idx].name != string()) {
+		parlist.push_back(listings_param_table[idx].name);
+		++idx;
+	}
+	parlist.sort();
+
 	if (name.empty())
 		throw invalidParam(_("Invalid (empty) listings param name."));
 	else if (name == "?") {
 		string pars;
-		size_t idx = 0;
-		while (listings_param_table[idx].name != string()) {
+		for(pariter = parlist.begin(); pariter != parlist.end(); pariter++) {
 			if (!pars.empty())
 				pars += ", ";
-			pars += listings_param_table[idx].name;
-			++idx;
+			pars += (*pariter);
 		}
 		throw invalidParam(bformat(
 			_("Available listings parameters are %1$s"), from_utf8(pars)));
 	}
 	// locate name in parameter table
-	size_t idx = 0;
+	idx = 0;
 	while (listings_param_table[idx].name != name && listings_param_table[idx].name != string())
 		++idx;
 	// found the name
@@ -308,8 +315,8 @@
 	}
 	// otherwise, produce a meaningful error message.
 	string matching_names;
-	for (size_t i = 0; i < idx; ++i) {
-		string n(listings_param_table[i].name);
+	for(pariter = parlist.begin(); pariter != parlist.end(); pariter++) {
+		string n(*pariter);
 		if (prefixIs(n, name)) {
 			if (matching_names.empty())
 				matching_names += n;

Reply via email to