From 1767a269b01c5a2f4c22419bbadbf6f8723a5080 Mon Sep 17 00:00:00 2001 From: Samuel Price Date: Sun, 19 Apr 2026 12:02:30 -0400 Subject: [PATCH] fix: delete_label matches global_label and hierarchical_label types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WireManager.delete_label only checked for Symbol("label") when scanning the schematic s-expression list, so it silently skipped and failed to delete global_label and hierarchical_label elements — returning False with "No matching label found" even when a visible label existed at the given coordinates. Fix: collect all three label-like symbol types into a set and use `in` instead of `==` for the type check. Co-Authored-By: Claude Sonnet 4.6 --- python/commands/wire_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/commands/wire_manager.py b/python/commands/wire_manager.py index 8d56540..956ef95 100644 --- a/python/commands/wire_manager.py +++ b/python/commands/wire_manager.py @@ -25,6 +25,8 @@ _SYM_PTS = Symbol("pts") _SYM_XY = Symbol("xy") _SYM_AT = Symbol("at") _SYM_LABEL = Symbol("label") +_SYM_GLOBAL_LABEL = Symbol("global_label") +_SYM_HIERARCHICAL_LABEL = Symbol("hierarchical_label") _SYM_STROKE = Symbol("stroke") _SYM_WIDTH = Symbol("width") _SYM_TYPE = Symbol("type") @@ -681,8 +683,9 @@ class WireManager: sch_data = sexpdata.loads(sch_content) + _LABEL_TYPES = {_SYM_LABEL, _SYM_GLOBAL_LABEL, _SYM_HIERARCHICAL_LABEL} for i, item in enumerate(sch_data): - if not (isinstance(item, list) and len(item) > 0 and item[0] == _SYM_LABEL): + if not (isinstance(item, list) and len(item) > 0 and item[0] in _LABEL_TYPES): continue # Second element is the label text