fix(renderer): 界面与设置页一轮修补
- FilePanel 上传进度监听器组件卸载时清理(原先只在终态/reject 时 off) - MonitorPanel:首采即失败时显示中断错误条,不再被 meta 门挡成永远 '采集中' - HighlightImportExport:blob 下载延迟 revokeObjectURL(原先同步回收 会中止下载);FileReader 补 onerror - HighlightTab 新建规则改 getState() 读法防 stale(对齐 replaceRule) - ConnectionSidebar/CommandsPanel 三处删除/清空 handler 补 try/catch 与 message.error(原先失败静默) - highlightIO 导入信封补 version 校验、kind 缺失不再放行 - i18n:补 settings.highlight.builtin.percent 四语言键(原先唯一缺失 的内置规则,非中文界面显示中文 note)
This commit is contained in:
1 parent
172cce1962
commit
6a218ec6c0
12 files changed
+108
-18
No files matched your search
+22
-1
@@ -15,7 +15,13 @@
|
||||
import { compileRules, applyHighlights, __testHooks as hooks } from '../src/renderer/src/terminal/highlightEngine.ts'
|
||||
import { previewSpans } from '../src/renderer/src/terminal/highlightEngine.ts'
|
||||
import { DEFAULT_HIGHLIGHT_RULES } from '../src/shared/settings.ts'
|
||||
import { exportHighlightRules, mergeRules, parseHighlightRules } from '../src/shared/highlightIO.ts'
|
||||
import {
|
||||
exportHighlightRules,
|
||||
HIGHLIGHT_FILE_KIND,
|
||||
HIGHLIGHT_FILE_VERSION,
|
||||
mergeRules,
|
||||
parseHighlightRules
|
||||
} from '../src/shared/highlightIO.ts'
|
||||
import {
|
||||
excludedByProfile,
|
||||
rulesForProfile,
|
||||
@@ -549,11 +555,26 @@ console.log('[import / export]')
|
||||
parseHighlightRules('{"kind":"openterminal.layout","rules":[]}').error === 'wrong-kind',
|
||||
'a foreign envelope is refused'
|
||||
)
|
||||
ok(
|
||||
parseHighlightRules('{"rules":[]}').error === 'wrong-kind',
|
||||
'an envelope with no kind at all is refused'
|
||||
)
|
||||
ok(
|
||||
parseHighlightRules(JSON.stringify({ kind: HIGHLIGHT_FILE_KIND, version: HIGHLIGHT_FILE_VERSION + 1, rules: [] }))
|
||||
.error === 'wrong-version',
|
||||
'an envelope from another version is refused'
|
||||
)
|
||||
ok(
|
||||
parseHighlightRules(JSON.stringify({ kind: HIGHLIGHT_FILE_KIND, rules: [] })).error === 'wrong-version',
|
||||
'an envelope with no version at all is refused'
|
||||
)
|
||||
ok(parseHighlightRules('{"nope":1}').error === 'no-rules', 'JSON without a rules array is refused')
|
||||
ok(parseHighlightRules('[]').error === undefined, 'a bare empty array is accepted')
|
||||
|
||||
const partial = parseHighlightRules(
|
||||
JSON.stringify({
|
||||
kind: HIGHLIGHT_FILE_KIND,
|
||||
version: HIGHLIGHT_FILE_VERSION,
|
||||
rules: [
|
||||
{ pattern: '\\bOK\\b', priority: 500, color: { fg: 'red' } },
|
||||
{ pattern: '[' },
|
||||
|
||||
Reference in new issue
Block a user