diff --git a/src/Context.cpp b/src/Context.cpp index 738ab6d56..45ea17213 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -694,19 +694,28 @@ void Context::createDefaultConfig () void Context::decomposeSortField ( const std::string& field, std::string& key, - bool& ascending) + bool& ascending, + bool& breakIndicator) { int length = field.length (); - if (field[length - 1] == '+') + int decoration = 1; + breakIndicator = false; + if (field[length - decoration] == '/') + { + breakIndicator = true; + ++decoration; + } + + if (field[length - decoration] == '+') { ascending = true; - key = field.substr (0, length - 1); + key = field.substr (0, length - decoration); } - else if (field[length - 1] == '-') + else if (field[length - decoration] == '-') { ascending = false; - key = field.substr (0, length - 1); + key = field.substr (0, length - decoration); } else { diff --git a/src/Context.h b/src/Context.h index a532ac6ad..398054c3a 100644 --- a/src/Context.h +++ b/src/Context.h @@ -71,7 +71,7 @@ public: void clearMessages (); void clear (); - void decomposeSortField (const std::string&, std::string&, bool&); + void decomposeSortField (const std::string&, std::string&, bool&, bool&); private: void staticInitialization (); diff --git a/src/sort.cpp b/src/sort.cpp index cafb767fc..0693f915d 100644 --- a/src/sort.cpp +++ b/src/sort.cpp @@ -71,6 +71,7 @@ static bool sort_compare (int left, int right) { std::string field; bool ascending; + bool breakIndicator; Column* column; int left_number; int right_number; @@ -82,7 +83,7 @@ static bool sort_compare (int left, int right) std::vector ::iterator k; for (k = global_keys.begin (); k != global_keys.end (); ++k) { - context.decomposeSortField (*k, field, ascending); + context.decomposeSortField (*k, field, ascending, breakIndicator); // Urgency. if (field == "urgency")