Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add Chinese support for excluding files and folders #166

Open
ZDFX opened this issue Nov 3, 2024 · 0 comments
Open

Please add Chinese support for excluding files and folders #166

ZDFX opened this issue Nov 3, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ZDFX
Copy link

ZDFX commented Nov 3, 2024

Feature Area

Settings

Painpoint

Exclude files and folders function does not support Chinese

Describe your idea

Make excluded files and folders support Chinese paths

Alternatives

I looked at the source code and guessed that the regular expression of the following function should be causing this problem:

// src/components/Settings/FuzzModal.ts
export function wildTest(wildcard: string, str: string): boolean {
    const w = wildcard.replace(/[.+^${}()|[\]\\]/g, '\\$&'); // regexp escape
    const re = new RegExp(`\\b${w.replace(/\*/g, '.*').replace(/\?/g, '.')}`, 'i');
    return re.test(str);
}

I'm not sure how to debug the plugin, but I guess the following modifications might solve the problem:

export function wildTest(wildcard: string, str: string): boolean {
    const w = wildcard.replace(/[.+^${}()|[\]\\]/g, '\\$&'); // regexp escape
    const re = new RegExp(`\\b${w.replace(/\*/g, '.*').replace(/\?/g, '.')}`, 'iu'); // 添加 'u' 标志以支持中文
    return re.test(str);
}

Additional Context

No response

@ZDFX ZDFX added the enhancement New feature or request label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants