From b5c1c61d956002e10e9a40bd89c41b0f7ececf52 Mon Sep 17 00:00:00 2001 From: Heyward Fann Date: Fri, 6 Sep 2024 09:49:13 +0800 Subject: [PATCH] fix(list): improve regex to remove CJK word Closes #5134 --- src/list/prompt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/list/prompt.ts b/src/list/prompt.ts index de53d59a60e..d0f1e9f53d8 100644 --- a/src/list/prompt.ts +++ b/src/list/prompt.ts @@ -167,7 +167,7 @@ export default class Prompt { if (cusorIndex == 0) return let pre = input.slice(0, cusorIndex) let post = input.slice(cusorIndex) - let remain = pre.replace(/[\w$]+([^\w$]+)?$/, '') + let remain = pre.replace(/[\w\s$\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]+([^\w\s$\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]+)?$/u, '') this.cusorIndex = cusorIndex - (pre.length - remain.length) this._input = `${remain}${post}` this.drawPrompt()