Remove redo; undo rename on a device

Redo is gone in both file and device mode: the Edit menu entry, Ctrl/Cmd+Y
and Ctrl/Cmd+Shift+Z, and the redo stack. An undone step is dropped.
Undoing past the last save now leaves the saved depth unreachable, so a
new edit cannot be mistaken for the saved state.

Renames on a device are undoable: LiveRenameCommand renames back on the
device first, and warns and clears history if the device refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 20:51:02 +03:00
co-authored by Claude Opus 5.5
parent 8b21c5f389
commit b63655462f
5 changed files with 50 additions and 56 deletions
+2 -16
View File
@@ -186,7 +186,7 @@ def refresh_dirty_display():
def refresh_all_views():
"""Rebuilds tree and canvas from the DOM. Registered as undo/redo's view refresh."""
"""Rebuilds tree and canvas from the DOM. Registered as undo's view refresh."""
sax_file.refresh_treeview_from_dom(app_state.xml_root_element)
wiresheet.render_current_sheet()
@@ -559,14 +559,6 @@ def do_undo(event=None):
return "break"
def do_redo(event=None):
label = undo.redo()
if label is None:
return "break"
app_state.window.title(f"{_base_title()} — redid {label}")
return "break"
def _base_title():
if app_state.live_mode:
return app_state.base_window_title_live()
@@ -943,7 +935,7 @@ def on_tree_select(event):
element = app_state.tree_element_map.get(selected_id)
components_to_render = []
# Remembered so undo/redo and tidy can repaint this same sheet from the DOM.
# Remembered so undo and tidy can repaint this same sheet from the DOM.
app_state.current_sheet_parent = element
record_visit(VIEW_SHEET, element)
@@ -2754,7 +2746,6 @@ tree_root_context_menu = tk.Menu(window, tearoff=0)
SHORTCUTS = [
("s", do_save),
("z", do_undo),
("y", do_redo),
("b", toggle_left_column),
# Zoom, in every spelling the key can arrive as: with and without Shift, and on the
# numeric keypad.
@@ -2774,10 +2765,6 @@ for key, handler in SHORTCUTS:
window.bind_all(f"<Command-{key}>", handler)
window.bind_all(f"<Control-{key}>", handler)
# Redo also as Shift-Z, the usual mac chord.
window.bind_all("<Command-Shift-Z>", do_redo)
window.bind_all("<Control-Shift-Z>", do_redo)
# Delete: the mac Delete key reports as BackSpace, the Windows one as Delete.
window.bind_all("<Delete>", delete_selected_component)
window.bind_all("<BackSpace>", delete_selected_component)
@@ -2817,7 +2804,6 @@ menu_bar.add_cascade(label="File", menu=menu_file)
menu_edit = tk.Menu(menu_bar, tearoff=0)
menu_edit.add_command(label="Undo", command=do_undo, accelerator=f"{accel_mod}+Z")
menu_edit.add_command(label="Redo", command=do_redo, accelerator=f"{accel_mod}+Y")
menu_edit.add_separator()
menu_edit.add_command(label="Delete Component", command=delete_selected_component, accelerator="Del")
menu_bar.add_cascade(label="Edit", menu=menu_edit)