Skip to content

Commit

Permalink
UI: Sort theme and script names case-insensitively.
Browse files Browse the repository at this point in the history
  • Loading branch information
zrax committed Dec 12, 2024
1 parent 0dba425 commit 2f815d1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/qtextpadwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,12 @@ void QTextPadWindow::populateThemeMenu()
m_themeMenu->addSeparator();

KSyntaxHighlighting::Repository *syntaxRepo = SyntaxTextEdit::syntaxRepo();
const auto themeDefs = syntaxRepo->themes();
auto themeDefs = syntaxRepo->themes();
std::sort(themeDefs.begin(), themeDefs.end(),
[](const KSyntaxHighlighting::Theme &left, const KSyntaxHighlighting::Theme &right)
{
return left.translatedName().compare(right.translatedName(), Qt::CaseInsensitive) < 0;
});
for (const auto &theme : themeDefs) {
auto item = m_themeMenu->addAction(theme.translatedName());
item->setCheckable(true);
Expand All @@ -1686,7 +1691,7 @@ void QTextPadWindow::populateEncodingMenu()
std::sort(encodingScripts.begin(), encodingScripts.end(),
[](const QStringList &left, const QStringList &right)
{
return left.first() < right.first();
return left.first().compare(right.first(), Qt::CaseInsensitive) < 0;
});

for (const auto &encodingList : encodingScripts) {
Expand Down

0 comments on commit 2f815d1

Please sign in to comment.