Skip to content

Commit

Permalink
fix(list): improve regex to remove CJK word (#5137)
Browse files Browse the repository at this point in the history
Closes #5134
  • Loading branch information
fannheyward authored Sep 6, 2024
1 parent 9c25f2f commit 640544d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/list/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 640544d

Please sign in to comment.