Skip to content

fix(macos): 修复长提示词导致的设置窗口卡顿 - #63

Open
xionghaizhi wants to merge 1 commit into
freestylefly:mainfrom
xionghaizhi:fix/macos-long-prompt-stutter
Open

xionghaizhi wants to merge 1 commit into
freestylefly:mainfrom
xionghaizhi:fix/macos-long-prompt-stutter

Conversation

@xionghaizhi

Copy link
Copy Markdown

问题

场景设置使用较长的中文提示词时,从 Dock 恢复窗口、切换场景和编辑提示词会出现卡顿。主线程采样指向多行 TextField 的自动高度计算和中文排版;只读提示词及预览区也会按全文参与布局。

修复

  • 将提示词输入框改为固定高度、内部滚动的 TextEditor,避免按全文反复计算高度。
  • 官方场景提示词和转发预览使用固定视口的原生 NSTextView,保留完整文本、选择和复制;内容未变化时不重新赋值,避免重复排版和选区重置。
  • 一次编辑只提交一个完整场景,避免分别修改三个字段时重复编码、保存整份场景配置。
  • 保留提示词空行及现有技能插入交互,避免切换编辑控件后误写其他文本框。

验证

  • 新增 7 个回归测试,覆盖长中文编辑框高度、预览滚动与缩放、完整文本和选区保留、单次保存及编辑交互。
  • 相同的编辑器、预览组件和回归测试已在 fork 的 macOS CI 通过。
  • 修复后的测试包已在实际 Mac 上复测,原先的卡顿暂未再出现。
  • 本 PR 从源仓库最新 main 单独提取修复。当前环境为 Linux,未在本地运行 AppKit 测试;此组合的自动验证以本 PR 的 CI 检查结果为准。

@freestylefly freestylefly left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xionghaizhi 麻烦同步最新的 main,并修复下方的 macOS 13 兼容性问题。修复后直接更新这个 PR,等 CI 通过后请重新提请审核和合并。谢谢!

.allowsHitTesting(false)
}
.focused($promptFocused)
.focusEffectDisabled()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前 main 的最低支持版本是 macOS 13,.focusEffectDisabled() 要求 macOS 14,合并后会导致编译失败。请改用 main 中已有的 .compatFocusEffectDisabled()。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants