Skip to content

Commit

Permalink
修改了跳过一次打印循环的字符的匹配范围
Browse files Browse the repository at this point in the history
  • Loading branch information
sheep-realms committed Aug 27, 2024
1 parent bdd181f commit 533aeab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
| ruby | Boolean | 是否正在打印包含注释的内容。 | false |
| filter | Object | 过滤器状态开关。 | 见下文。 |
| event | Object | 用于绑定事件。 ||
| CJKAndFullWidthSymbolAndEmoji | RegExp | 需要跳过一个打印循环的字符。 ||

#### 属性 filter 中的值
| 名称 | 类型 | 描述 | 默认值 |
Expand Down
5 changes: 3 additions & 2 deletions js/echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Echo {
stop: function() {},
typewriteEnd: function() {}
};
this.CJKAndFullWidthSymbolAndEmoji = /[\u2014-\u2015\u2018-\u2019\u201c-\u201d\u2e80-\u9fff\uac00-\ud7ff\uf900-\ufaff\ufe10-\ufe1f\ufe30-\ufe4f\uff01-\uff60\uffe0-\uffe7\u{17000}-\u{1b2ff}\u{20000}-\u{2fa1f}\u{30000}-\u{323af}\p{Emoji}]/u;

if ($sel != '') {
this.rd($sel);
Expand Down Expand Up @@ -207,8 +208,8 @@ class Echo {
} else {
if (typeof that.messageBuffer[0] == 'string') {
a = that.messageBuffer.shift();
// 中日韩字符和辅助平面字符跳过一回合
if ((a.search(/[\u4e00-\u9fa5\u0800-\u4e00\uac00-\ud7ff]/) != -1 || a.codePointAt(0) >= 0x10000) && that.typewrite == 'none') {
// 中日韩字符及其他汉字文化圈字符和 Emoji 字符跳过一回合
if ((a.search(this.CJKAndFullWidthSymbolAndEmoji) != -1) && that.typewrite == 'none') {
that.dbChrBuffer = a;
return;
}
Expand Down

0 comments on commit 533aeab

Please sign in to comment.