Snap editor records one Undo step per keystroke and per slider tick

未关闭
#331 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
swift
领域
desktop

调研方向

Start with the change() and undo() logic in ImageWorkspaceEditing.swift (around lines 103-118 and 110), then the updateSelected calls for the caption and sliders in SnapEditorView.swift (lines 94, 103, 109). Compare with the canvas drag commit in ImageWorkspaceCanvas.swift (lines 212-213). Done means the acceptance cases pass under --check-image-workspace: 150 keystrokes make one undo step, and undo order is text, mark, then crop.

由索引模型根据 Issue 内容生成。

描述

bug

Outcome: typing a caption or dragging Text size or Line width makes one Undo step, so earlier crops and marks stay undoable.

Evidence (main edc15df)
  • The text binding and the sliders call updateSelected on every change (SnapEditorView.swift:94, :103, :109).
  • change() pushes every edit and trims to 100 entries (ImageWorkspaceEditing.swift:103-118). A caption of about 100 characters therefore drops the crop from history.
  • undo() clears the selection (:110), which closes the inspector.
  • Canvas drags already commit once (ImageWorkspaceCanvas.swift:212-213).
  • docs/snap.md:22 promises Undo for crop, text and marks.
Change
  • Add a coalescing key (mark id plus property). Consecutive edits with the same key replace the top entry.
  • select, undo and redo reset the key.
  • After undo or redo, reselect the mark if it still exists.
Acceptance

In --check-image-workspace:

  • 150 keystrokes make one step.
  • Undo order is text, then the mark, then the crop.
  • Redo restores.
  • A fontSize run is one step.
  • A selection change or an unkeyed edit splits runs.
  • An edit after undo starts a new step.
Value before scope
  1. Outcome: Undo works on the capture-to-deck path. Evidence: the traced stack.
  2. Simpler route: none.
  3. Owner: ImageWorkspaceEditing.
  4. Complexity: one key.
  5. Verified by: source checks.

Grammar: Quality.

Refs #154


Build-ready record from the overnight lead session of 15 Oct 2026, verified against main edc15df by an independent skeptic per item. Implementation follows on a claude/* branch; this issue closes only after native acceptance.

主要语言
Swift
星标
0
派生
1
平均合并
18 小时 19 分钟
30 天内合并 PR
114

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Ship-Work/workbench 的其他 Issue

查看 Ship-Work/workbench 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。