From e886f7635b95b8af8d4aa6a51ac73e0aaab6f22d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 28 Jul 2010 17:47:58 -0400 Subject: [PATCH] Enhancement - When presenting lists of ambiguous command, attributes and modifiers to the user, it is now a sorted list. --- src/Att.cpp | 3 +++ src/Cmd.cpp | 14 ++++++++------ src/text.cpp | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Att.cpp b/src/Att.cpp index 90c61877b..3c979aeec 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -25,6 +25,7 @@ // //////////////////////////////////////////////////////////////////////////////// +#include #include #include #include @@ -253,6 +254,7 @@ bool Att::validNameValue ( { std::string error = "Ambiguous attribute '" + name + "' - could be either of "; // TODO i18n + std::sort (matches.begin (), matches.end ()); std::string combined; join (combined, ", ", matches); @@ -278,6 +280,7 @@ bool Att::validNameValue ( { std::string error = "Ambiguous modifier '" + mod + "' - could be either of "; // TODO i18n + std::sort (matches.begin (), matches.end ()); std::string combined; join (combined, ", ", matches); error += combined; diff --git a/src/Cmd.cpp b/src/Cmd.cpp index d7b30a6bd..fc62e7d1d 100644 --- a/src/Cmd.cpp +++ b/src/Cmd.cpp @@ -25,13 +25,14 @@ // //////////////////////////////////////////////////////////////////////////////// +#include // TODO Remove #include -#include "Cmd.h" -#include "Context.h" -#include "util.h" -#include "text.h" -#include "i18n.h" -#include "main.h" +#include +#include +#include +#include +#include +#include extern Context context; @@ -94,6 +95,7 @@ void Cmd::parse (const std::string& input) { std::string error = "Ambiguous command '" + candidate + "' - could be either of "; // TODO i18n + std::sort (matches.begin (), matches.end ()); std::string combined; join (combined, ", ", matches); throw error + combined; diff --git a/src/text.cpp b/src/text.cpp index 01505dd00..657db2ce6 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -25,6 +25,7 @@ // //////////////////////////////////////////////////////////////////////////////// +#include #include #include #include @@ -397,6 +398,8 @@ void guess ( else { + std::sort (matches.begin (), matches.end ()); + std::string error = "Ambiguous "; // TODO i18n error += type; error += " '";