Skip to content

Commit

Permalink
Revert changes to spec_sort
Browse files Browse the repository at this point in the history
  • Loading branch information
twanvl committed Apr 27, 2020
1 parent f4b2a43 commit a8b7699
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/util/spec_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ size_t count_and_remove(wxUniChar c, Bag& input) {
for (size_t i=0 ; i < input.size() ; ++i) {
if (input[i] == c) {
count++;
input[i] = REMOVED;
} else {
input[j++] = input[i];
//input[j++] = input[i];
}
}
input.resize(j);
//input.resize(j);
return count;
}

Expand Down Expand Up @@ -172,11 +173,9 @@ void mixed_sort(const String& spec, Bag& input, Bag& ret) {
for (wxUniCharRef c : input) {
if (spec.find(c) != String::npos) {
ret += c;
} else {
input[j++] = c;
c = REMOVED;
}
}
input.resize(j);
}

/// Sort a string, find a compound item
Expand All @@ -187,13 +186,10 @@ void compound_sort(const String& spec, Bag& input, Bag& ret) {
// match?
if (i+spec.size() <= input.size() && std::equal(spec.begin(), spec.end(), input.begin()+i)) {
i += spec.size() - 1;
//std::copy(spec.begin(), spec.end(), back_inserter(ret));
ret += spec;
} else {
input[j++] = input[i];
input[i] = REMOVED;
}
}
input.resize(j);
}

/// Sort things matching a pattern
Expand All @@ -214,11 +210,9 @@ void pattern_sort(const String& pattern, const String& spec, Bag& input, Bag& re
wxUniChar p = pattern[j];
if (c == REMOVED) {
goto no_match;
}
else if (p == PLACEHOLDER) {
} else if (p == PLACEHOLDER) {
placeholders += c;
}
else if (c != p) {
} else if (c != p) {
goto no_match;
}
}
Expand All @@ -232,8 +226,7 @@ void pattern_sort(const String& pattern, const String& spec, Bag& input, Bag& re
wxUniChar p = pattern[j];
if (p == PLACEHOLDER) {
ret += new_placeholders[ph++];
}
else {
} else {
ret += p;
}
}
Expand Down

0 comments on commit a8b7699

Please sign in to comment.