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
+14
View File
@@ -1234,6 +1234,11 @@ def render_components(components_to_render):
"""Handles parsing and visual painting of given component listings on canvas with slot attributes."""
canvas = app_state.canvas
app_state.active_components_list = components_to_render
# Repainting the same sheet (a refresh, an undo, a device update) keeps whatever of
# the selection is still on it; another sheet starts with nothing selected.
kept = [app_state.canvas_comp_map.get(t) for t in app_state.selected_canvas_tags
if t != app_state.selected_canvas_tag]
kept.append(app_state.canvas_comp_map.get(app_state.selected_canvas_tag))
app_state.selected_canvas_tag = None
app_state.selected_canvas_tags.clear()
@@ -1275,6 +1280,15 @@ def render_components(components_to_render):
draw_links()
apply_sheet_zoom(fonts)
on_sheet = set(components_to_render)
for element in kept:
if element is not None and element in on_sheet:
tag = app_state.canvas_tag_by_element[element]
app_state.selected_canvas_tags.add(tag)
app_state.selected_canvas_tag = tag
for tag in app_state.selected_canvas_tags:
canvas.itemconfig(f"{tag} && block_outline", outline="#1f4e79", width=3)
def apply_sheet_zoom(fonts):
"""Scales the finished sheet to app_state.zoom and sizes the canvas to match.