Fix New+ context menu not showing folders with only numbers

Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-29 07:08:17 +00:00
parent 2481374209
commit 02ea538eb3

View File

@@ -60,7 +60,17 @@ std::wstring template_item::get_target_filename(const bool include_starting_digi
std::wstring template_item::remove_starting_digits_from_filename(std::wstring filename) const
{
filename.erase(0, min(filename.find_first_not_of(L"0123456789"), filename.size()));
// Find first non-digit character
size_t first_non_digit = filename.find_first_not_of(L"0123456789");
// If the string consists only of digits, don't remove anything
if (first_non_digit == std::wstring::npos)
{
return filename;
}
// Otherwise, remove starting digits as before
filename.erase(0, first_non_digit);
filename.erase(0, min(filename.find_first_not_of(L" ."), filename.size()));
return filename;