[PR #16772] Add new and extend existing til::string helpers #30990

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

Original Pull Request: https://github.com/microsoft/terminal/pull/16772

State: closed
Merged: Yes


wstring_case_insensitive_compare is not a great name for what it
does as it's incorrect to use for regular (human readable) strings.
This PR thus renames it to env_key_sorter.

compare_string_ordinal was renamed to compare_ordinal_insensitive
to make sure callers know that the comparison is insensitive
(this may otherwise be incorrect in certain contexts after all).
The return value was changed to match memcmp so that the API
is detached from its underlying implementation (= NLS).

compare_linguistic_insensitive and contains_linguistic_insensitive
were added to sort and filter human-readable strings respectively.

prefix_split was extended to allow for needles that are just a
single character. This significantly improves the generated assembly
and is also usually what someone would want to actually use.
I've left the string-as-needle variant in just in case.

This PR is prep-work for #2664

**Original Pull Request:** https://github.com/microsoft/terminal/pull/16772 **State:** closed **Merged:** Yes --- `wstring_case_insensitive_compare` is not a great name for what it does as it's incorrect to use for regular (human readable) strings. This PR thus renames it to `env_key_sorter`. `compare_string_ordinal` was renamed to `compare_ordinal_insensitive` to make sure callers know that the comparison is insensitive (this may otherwise be incorrect in certain contexts after all). The return value was changed to match `memcmp` so that the API is detached from its underlying implementation (= NLS). `compare_linguistic_insensitive` and `contains_linguistic_insensitive` were added to sort and filter human-readable strings respectively. `prefix_split` was extended to allow for needles that are just a single character. This significantly improves the generated assembly and is also usually what someone would want to actually use. I've left the string-as-needle variant in just in case. This PR is prep-work for #2664
claunia added the pull-request label 2026-01-31 09:44:24 +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#30990