Wiresheet: arrow nudges keep the selection and the sheet's focus

Ctrl+A hands the sheet the keyboard, and repainting the same sheet keeps
whatever of the selection is still on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 14:40:07 +03:00
co-authored by Claude Opus 5.5
parent 1a4c84f9d5
commit 0d5e5115d9
3 changed files with 25 additions and 1 deletions
+10
View File
@@ -1357,6 +1357,8 @@ def select_all_boxes(event=None):
return None
wiresheet.deselect_link() # links and boxes are never selected together
select_canvas_boxes(list(app_state.canvas_comp_map))
# Hand the sheet the keyboard, so the arrows move the boxes rather than the tree.
app_state.canvas.focus_set()
count = len(app_state.selected_canvas_tags)
app_state.set_status(f"{count} component{'s' if count != 1 else ''} selected.")
return "break"
@@ -2270,7 +2272,15 @@ def nudge_selected_boxes(dx, dy):
"meta_before": meta_prop.get("val") if meta_prop is not None else None})
canvas.move(tag, shift_x, shift_y)
app_state.drag_data.update(tag=tags[0], group=group, moved=True, collapse_to=None)
pressed_last = app_state.selected_canvas_tag
on_canvas_release(None)
# The same boxes stay selected, and the sheet keeps the keyboard, so the next
# arrow press moves them again.
still_here = [t for t in tags if t in app_state.canvas_comp_map and t != pressed_last]
if pressed_last in app_state.canvas_comp_map:
still_here.append(pressed_last)
select_canvas_boxes(still_here)
canvas.focus_set()
return "break"