diff options
| author | blasty <blasty@local> | 2026-07-09 20:56:08 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-09 20:56:08 +0200 |
| commit | c5499b4e69c969e1c8dcc0f98f7df023c8b8407f (patch) | |
| tree | b9330c781ff89dfee8d957c311a234233f6baeeb /idatui/domain.py | |
| parent | rename: refuse pseudocode goto-labels with a clear message (diff) | |
| download | ida-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 'idatui/domain.py')
| -rw-r--r-- | idatui/domain.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/idatui/domain.py b/idatui/domain.py index 55a95d5..4902a64 100644 --- a/idatui/domain.py +++ b/idatui/domain.py @@ -508,6 +508,13 @@ class Program: raise KeyError(f"cannot resolve {target!r}") return _as_int(fn["addr"]) + # -- comments ---------------------------------------------------------- # + def set_comment(self, ea: int, text: str): + """Set (empty text clears) the comment at ``ea``; affects both the disasm + and decompiler views. Returns the raw payload so the caller can surface a + soft per-item error. The caller must invalidate/recompile to see it.""" + return self.client.call("set_comments", items=[{"addr": hex(ea), "comment": text}]) + # -- invalidation (after edits) --------------------------------------- # def invalidate(self, ea: int) -> None: """Drop caches for a function after a rename/comment/patch/etc.""" |
