Skip to content

Sketcher: saved-state tracking, history fixes, undo/redo toolbar - #367

Merged
knipknap merged 1 commit into
mainfrom
sketcher-saved-state-and-history-fixes
Aug 25, 2026
Merged

Sketcher: saved-state tracking, history fixes, undo/redo toolbar#367
knipknap merged 1 commit into
mainfrom
sketcher-saved-state-and-history-fixes

Conversation

@knipknap

Copy link
Copy Markdown
Contributor

Summary

A set of fixes for the sketcher around document saved-state tracking and undo/redo history:

  • Ctrl+S now works in the sketcher: unhandled Ctrl-based key presses propagate to the application-level shortcut controller instead of being swallowed by the tool shortcut sequence handler.
  • Document is marked as changed while editing the sketch: the sketcher's own HistoryManager is now connected to the document's saved-state tracking. Undoing back to the state at sketch entry restores the previous saved state.
  • Dragging an entity creates an undoable command: added MoveEntitiesCommand; previously moving a complete line bypassed the history entirely (not undoable, did not mark doc as changed).
  • Constraint add + edit dialog coalesce into one history entry: new HistoryManager.coalesce() forces coalescing with the previous command, bypassing the 0.5s time threshold. The no-op CreateOrEditConstraintCommand (when an existing constraint is found) is skipped from history.
  • Drag threshold in edit mode: prevents sub-pixel mouse jitter between double-clicks from registering a spurious "Move Entities" history entry.
  • No more spurious "Rename Sketch" history entry when opening a sketch (caused by programmatically setting the name row text).
  • Undo/redo buttons with dropdown history added to the sketcher toolbar.

Testing

  • pixi run lint passes
  • Sketcher UI tests: 152 passed
  • Core undo tests: 78 passed

… buttons

- Mark the document as changed while the sketch is being edited (the
  sketcher uses its own HistoryManager which was disconnected from the
  document's saved-state tracking). Undoing back to the entry state
  restores the previous saved state.
- Add MoveEntitiesCommand so dragging an entity creates an undoable
  command; previously entity moves bypassed the history entirely.
- Coalesce the constraint-create + dialog-edit into a single history
  entry via a new HistoryManager.coalesce() that bypasses the time
  threshold. Skip the no-op CreateOrEditConstraintCommand when an
  existing constraint is found.
- Apply the drag threshold in edit mode to prevent sub-pixel jitter
  between double-clicks from registering spurious moves.
- Suppress the spurious "Rename Sketch" history entry triggered by
  programmatically setting the name row during set_sketch.
- Add undo/redo buttons with dropdown history to the sketcher toolbar.

Fixes Ctrl+S not working inside the sketcher.
@knipknap
knipknap merged commit 5bc2192 into main Aug 25, 2026
29 checks passed
@knipknap
knipknap deleted the sketcher-saved-state-and-history-fixes branch August 25, 2026 18:01
knipknap added a commit that referenced this pull request Aug 25, 2026
…ry-fixes

Sketcher: saved-state tracking, history fixes, undo/redo toolbar
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.

1 participant