mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Stream chinese text in chat character-by-character (#214046)
Fix #213287
This commit is contained in:
parent
e0e011ce60
commit
fca05df7d4
|
@ -11,7 +11,7 @@ export interface IWordCountResult {
|
|||
|
||||
export function getNWords(str: string, numWordsToCount: number): IWordCountResult {
|
||||
// Match words and markdown style links
|
||||
const allWordMatches = Array.from(str.matchAll(/\[([^\]]+)\]\(([^)]+)\)|[^\s\|\-]+/g));
|
||||
const allWordMatches = Array.from(str.matchAll(/\[([^\]]+)\]\(([^)]+)\)|\p{sc=Han}|[^\s\|\-|\p{sc=Han}]+/gu));
|
||||
|
||||
const targetWords = allWordMatches.slice(0, numWordsToCount);
|
||||
|
||||
|
|
Loading…
Reference in a new issue