[PR #9943] [MERGED] Teach CmdPal search to use user locale #27818

Open
opened 2026-01-31 09:24:28 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9943
Author: @Don-Vito
Created: 4/25/2021
Status: Merged
Merged: 5/5/2021
Merged by: @undefined

Base: mainHead: 9941-case-sensitive-search


📝 Commits (1)

  • 938453e Teach CmdPal search to use user locale

📊 Changes

1 file changed (+5 additions, -2 deletions)

View changed files

📝 src/cascadia/TerminalApp/FilteredCommand.cpp (+5 -2)

📄 Description

PR Checklist

Detailed Description of the Pull Request / Additional comments

The bug is due to us using std::tolower, while the default locale is not user's locale.
The fix here is to use the same approach as upon sorting: lstrcmpi.
While there are additional methods to do locale aware comparison,
here we convert chars to string and call lstrcmpi.
While this approach seems somewhat inefficient it ensures consistency
(with the order of locales that lstrcmi tries to apply internally).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9943 **Author:** [@Don-Vito](https://github.com/Don-Vito) **Created:** 4/25/2021 **Status:** ✅ Merged **Merged:** 5/5/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `9941-case-sensitive-search` --- ### 📝 Commits (1) - [`938453e`](https://github.com/microsoft/terminal/commit/938453eb685dec2bf09dcaca4d6ab5612ee32d5d) Teach CmdPal search to use user locale ### 📊 Changes **1 file changed** (+5 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/FilteredCommand.cpp` (+5 -2) </details> ### 📄 Description ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/issues/9941 * [x] CLA signed. ## Detailed Description of the Pull Request / Additional comments The bug is due to us using std::tolower, while the default locale is not user's locale. The fix here is to use the same approach as upon sorting: lstrcmpi. While there are additional methods to do locale aware comparison, here we convert chars to string and call lstrcmpi. While this approach seems somewhat inefficient it ensures consistency (with the order of locales that lstrcmi tries to apply internally). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:24:28 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27818