summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-command-options-writer.cpp6
-rw-r--r--source/core/slang-command-options.cpp7
2 files changed, 9 insertions, 4 deletions
diff --git a/source/core/slang-command-options-writer.cpp b/source/core/slang-command-options-writer.cpp
index 9135998af..308cc4984 100644
--- a/source/core/slang-command-options-writer.cpp
+++ b/source/core/slang-command-options-writer.cpp
@@ -157,7 +157,7 @@ void MarkdownCommandOptionsWriter::_appendQuickLinks()
const auto& categories = m_commandOptions->getCategories();
const auto count = categories.getCount();
- m_builder << "## Quick Links\n\n";
+ m_builder << "### Quick Links\n\n";
for (Index categoryIndex = 0; categoryIndex < count; ++categoryIndex)
{
@@ -317,7 +317,7 @@ void MarkdownCommandOptionsWriter::_appendDescriptionForCategory(Index categoryI
<< "\"></a>\n";
}
- m_builder << "# " << category.name << "\n\n";
+ m_builder << "## " << category.name << "\n\n";
// If there is a description output, making \n split paragraphs
if (category.description.getLength() > 0)
@@ -351,7 +351,7 @@ void MarkdownCommandOptionsWriter::_appendDescriptionForCategory(Index categoryI
<< "\"></a>\n";
}
- m_builder << "## ";
+ m_builder << "### ";
StringUtil::join(names.getBuffer(), names.getCount(), toSlice(", "), m_builder);
m_builder << "\n";
diff --git a/source/core/slang-command-options.cpp b/source/core/slang-command-options.cpp
index a4bb8b552..30eaed333 100644
--- a/source/core/slang-command-options.cpp
+++ b/source/core/slang-command-options.cpp
@@ -333,7 +333,11 @@ void CommandOptions::addValuesWithAliases(const ConstArrayView<NameValue>& inVal
List<NameValue> values;
values.addRange(inValues.getBuffer(), inValues.getCount());
- values.sort([](const NameValue& a, const NameValue& b) -> bool { return a.value < b.value; });
+ // Use stable_sort to preserve the original order for names with the same value.
+ std::stable_sort(
+ values.begin(),
+ values.end(),
+ [](const NameValue& a, const NameValue& b) -> bool { return a.value < b.value; });
List<UnownedStringSlice> names;
@@ -346,6 +350,7 @@ void CommandOptions::addValuesWithAliases(const ConstArrayView<NameValue>& inVal
const auto value = values[i].value;
names.add(UnownedStringSlice(values[i++].name));
+ // For all names with the same value, preserve their original order (primary first)
for (; i < count && values[i].value == value; ++i)
{
names.add(UnownedStringSlice(values[i].name));