aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-09 20:56:08 +0200
committerblasty <blasty@local>2026-07-09 20:56:08 +0200
commitc5499b4e69c969e1c8dcc0f98f7df023c8b8407f (patch)
treeb9330c781ff89dfee8d957c311a234233f6baeeb /tests
parentrename: refuse pseudocode goto-labels with a clear message (diff)
downloadida-tui-c5499b4e69c969e1c8dcc0f98f7df023c8b8407f.tar.gz
ida-tui-c5499b4e69c969e1c8dcc0f98f7df023c8b8407f.tar.xz
ida-tui-c5499b4e69c969e1c8dcc0f98f7df023c8b8407f.zip
comments: ';' sets a comment on the current line (disasm + pseudocode)
Bind ';' (NavMixin, so both code views) to a comment prompt for the line under the cursor. Resolve the line's address (_cursor_ea in disasm, the /*0xEA*/ marker in pseudocode), prefill any existing comment (parsed from the rendered '//' text), and apply via the set_comments tool; an empty value clears it. After setting, reuse the name-generation invalidation (bump_names) so Hex-Rays is force_recompiled lazily and the pseudocode/disasm refresh in place at the saved position -- the new '// comment' shows on the line. Marks the IDB dirty (Ctrl+S). Pilot checks for the pseudocode round-trip. full suite 63/63.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tui.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_tui.py b/tests/test_tui.py
index ca5cea9..b8eba79 100644
--- a/tests/test_tui.py
+++ b/tests/test_tui.py
@@ -629,6 +629,35 @@ async def run(db):
else:
check("found a pseudocode label to test", False, "no LABEL_ found")
+ # Add a comment on the current pseudocode line via ';' and confirm it
+ # renders after the decompiler refreshes.
+ cline = next((i for i, t in enumerate(dec._texts)
+ if i > 5 and "/*0x" in t and t.strip() and "//" not in t), None)
+ if cline is not None:
+ cea = dec._line_ea(cline)
+ dec.focus()
+ dec.cursor, dec.cursor_x = cline, 2
+ dec.refresh()
+ await pilot.pause(0.05)
+ await pilot.press("semicolon")
+ await pilot.pause(0.1)
+ ci = app.query_one("#comment", Input)
+ cnote = f"note_{os.getpid()}"
+ check("';' opens the comment prompt on the current line", ci.display,
+ f"display={ci.display}")
+ ci.value = cnote
+ await pilot.press("enter")
+ await wait_until(
+ pilot, lambda: dec.loaded_ea == app._cur.ea
+ and any(cnote in t for t in dec._texts), timeout=25)
+ check("comment appears in the pseudocode after ';'",
+ any(cnote in t for t in dec._texts), "comment not shown")
+ # revert via the API for clean, race-free cleanup
+ app.program.client.call(
+ "set_comments", items=[{"addr": hex(cea), "comment": ""}])
+ else:
+ check("found a pseudocode line to comment", False, "no marker line")
+
# Decompiler follow of a name NOT in refs (the function's own name).
await pilot.press("g")
await pilot.pause(0.1)