fix(insertion): 修正 macOS 无权限时插入状态#92
Merged
Merged
Conversation
Before posting Cmd+V on macOS, check the current Accessibility trust state. If permission has been revoked, keep the transcript on the clipboard and reuse the existing CopiedFallback path instead of recording a successful insertion. Constraint: Keep issue Open-Less#62 fix minimal and avoid adding unreliable target-control paste verification Rejected: AX focused-value readback with timeout | broader and brittle across apps/web editors Confidence: medium Scope-risk: narrow Tested: cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml Tested: git diff --check Not-tested: Live macOS Accessibility revoke flow on this host
There was a problem hiding this comment.
Sorry @H-Chris233, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
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.
摘要
Fixes #62。
本 PR 按最小改动修复 macOS 在无辅助功能权限时,历史记录仍被标记为已插入的问题。
此前
simulate_paste()在调用CGEventPost模拟 Cmd+V 后,没有先检查 Accessibility 权限,也没有验证粘贴是否真的成功。当辅助功能权限被撤销时,实际文本不会进入用户输入框,但历史详情仍可能显示为Inserted。本次改动在 macOS
simulate_paste()执行CGEventPost前增加 Accessibility 权限检查。未授权时直接返回错误,并沿用现有TextInserter::insert()逻辑回退到InsertStatus::CopiedFallback,避免历史记录虚假标记为已插入。修复 / 新增 / 改进
macOS
simulate_paste()在CGEventPost前检查 Accessibility 权限。当辅助功能权限未授权时:
TextInserter::insert()现有 fallback 逻辑InsertStatus::CopiedFallback修复无辅助功能权限时历史记录错误显示
Inserted的问题。保持剪贴板 fallback 行为不变。
只修改
insertion.rs,不扩大改动范围。兼容
不包含:
TextInserter::insert()fallback 语义。对现有用户 / 本地环境 / 构建流程的影响:
CopiedFallback。测试计划
命令:
cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml结果:通过,仅有既有 warnings
证据路径:本地检查输出
命令:
git diff --check结果:通过
证据路径:本地命令输出
主要改动文件
openless-all/app/src-tauri/src/insertion.rs备注
本 PR 选择最小修复路径:在 macOS 发送模拟粘贴事件前先检查 Accessibility 权限。暂未加入 timeout 检测或 pasteboard read-back,因为本次目标是先避免历史记录在无权限场景下显示虚假的
Inserted。