From ae3399da08a54e3ecdc8b4c3e622efbf54b55dae Mon Sep 17 00:00:00 2001 From: blasty Date: Fri, 10 Jul 2026 13:02:05 +0200 Subject: struct editor: auto-format the definition on save After a successful declare, re-fetch the canonical struct_source and put it back in the editor, so the normalized layout/types show immediately instead of only after re-selecting the struct from the list (e.g. a pasted one-liner becomes multi-line, 'unsigned long' -> 'unsigned __int64'). _loaded_src is updated to the formatted text so it isn't considered dirty. Pilot check. full suite 92/92. --- tests/test_tui.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/test_tui.py b/tests/test_tui.py index e990bef..6a8f898 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -180,6 +180,11 @@ async def run(db): await wait_until(pilot, lambda: any(s.name == sname for s in se._structs), 15) check("Ctrl+S declares a new struct", any(s.name == sname for s in se._structs), "not created") + # save auto-formats the (one-line) definition to canonical layout + await wait_until(pilot, lambda: "\n" in ta.text, 10) + check("save auto-formats the definition in the editor", + ta.text.count("\n") >= 3 and f"struct {sname}" in ta.text + and not se._is_dirty(), f"text={ta.text[:50]!r}") # update it (add a field -> member count grows) idx = next(i for i, s in enumerate(se._structs) if s.name == sname) se.on_option_list_option_selected(type("E", (), {"option_index": idx})()) -- cgit v1.3.1-sl0p