Otherwise, '?something ' will not match anything.

I guess, a trim is already applied. I updated the code for the situations '? something' and attached the patch. However, It does not cover the situations '?some thing'.
I used trim (), but since the string is already trimmed, rtrim() is actually 
enough for the purpose. You can test and commit with rtrim..

contains.. sure.. but, you know it is exactly the same thing with what I am
doing now. What is the advantage of it then?

For consistency.

fair enough.. done..


After 1.5.0 please. Time would be better spent on real bugs now.

Bo

Sure thing. I have no plans to touch it before the release.


regards,

ugras
Index: insets/InsetListingsParams.cpp
===================================================================
--- insets/InsetListingsParams.cpp	(revision 18564)
+++ insets/InsetListingsParams.cpp	(working copy)
@@ -40,6 +40,7 @@
 using support::prefixIs;
 using support::suffixIs;
 using support::getVectorFromString;
+using lyx::support::contains;
 
 namespace {
 
@@ -606,6 +607,23 @@
 	if (name == "?")
 		throw invalidParam(bformat(
 			_("Available listings parameters are %1$s"), from_ascii(all_param_names_)));
+	
+	else if (prefixIs(name, "?")) {
+		string suffix(trim(string(name, 1)));
+		string param_names;
+		ListingsParams::const_iterator it = all_params_.begin();
+		ListingsParams::const_iterator end = all_params_.end();
+		for (; it != end; ++it) {
+			if(contains(it->first,suffix)) {
+				if (!param_names.empty())
+					param_names += ", ";
+				param_names += it->first;
+			}
+		}
+		throw invalidParam(bformat(
+				_("Available listings parameters containing string \"%1$s\" are %2$s"), 
+					from_utf8(suffix), from_utf8(param_names)));
+	}
 
 	// locate name in parameter table
 	ListingsParams::const_iterator it = all_params_.find(name);

Reply via email to