Closed Matteo-Nigro closed 1 month ago
That's expected, whole upper-case word (e.g. ACM) is treated as abbreviation.
It's might better to use ICU u_strToTitle()
than our EditTitleCase()
:
HMODULE icu = LoadLibraryExW(L"icu.dll", nullptr, kSystemLibraryLoadFlags);
if (icu) {
using strToTitleSig = int32_t (__cdecl*)(LPWSTR dest, int32_t destCapacity, LPCWSTR src, int32_t srcLength, HANDLE titleIter, const char *locale, int *errorCode);
u_strToTitleSig pfn_strToTitle = DLLFunction<u_strToTitleSig>(icu, "u_strToTitle");
if (pfn_strToTitle) {
char localeName[LOCALE_NAME_MAX_LENGTH] = "";
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SNAME, localeName, COUNTOF(localeName));
int errorCode = 0;
int charsConverted = pfn_strToTitle(pszTextW, cchTextW, pszTextW, cchTextW, nullptr, localeName, &errorCode);
if (charsConverted > 0 && errorCode <= 0) {
bChanged = true;
flags = 0;
}
}
FreeLibrary(icu);
}
Ok @zufuliu. Thanks for the reply. Since the behavior of the function is as expected...So I don't understand how to proceed... Should I replace the code you suggested in the existing function or do you want me to leave everything unchanged and use the code privately?
I reopened issue #241 for title casing discussion, you can revert changes in Edit.cpp.
Ok I undid the changes to the Edit.cpp file keeping only the update to the rc file. Regarding the reopening of the discussion #241, I'll write my thoughts directly there. Thanks
Fixed a bug on the Title Case (Ctrl+Alt+I). When the text is all in capitals, it does not work. It may not be the most elegant method, but it works.