fix(windows): 修复差异视图中 pom.xml 因重叠高亮导致文字错乱 - #473
Merged
Conversation
XML 高亮不再捕获跨子元素的 content 节点,diff 渲染优先保留更窄的 token,并将跨行 token 裁剪到当前行,避免切片拼接重复字符。Fixes 1lck#428 Co-authored-by: Cursor <cursoragent@cursor.com>
测试中改用全局正则替换解码 HTML 实体,避免当前 TS lib 不支持 String.replaceAll。 Co-authored-by: Cursor <cursoragent@cursor.com>
1lck
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pom.xml(及其他嵌套 XML)因语法高亮 token 重叠而被重复切片渲染,导致文字错乱/重影的问题。content节点。Fixes #428
改动说明
windows/tauri/public/tree-sitter/parsers/xml/highlights.scm移除
(content) @string。该捕获在 Mavenpom.xml这类嵌套结构中会生成跨多行、覆盖子标签的宽范围 token。git-diff-line.tsx渲染高亮内容前解析重叠 token:优先保留更窄、更具体的捕获,再按列顺序拼接,保证可见文本与源行一致。
use-git-diff-highlight.ts将跨行 token 映射到 diff 行时按当前行边界裁剪,避免把首尾行的 column 误用到中间行。
Test plan
bun test src/features/git/components/diff/git-diff-line.test.tsx src/features/git/hooks/use-git-diff-highlight.test.ts./.agents/skills/write-stable-tests/scripts/verify-test-stability.ps1