aboutsummaryrefslogtreecommitdiffstats
path: root/idatui/app.py
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-10 16:12:22 +0200
committerblasty <blasty@local>2026-07-10 16:12:22 +0200
commit3b4e397f48e4519c6b5a24fede2e41707e355a92 (patch)
treecfe046e03d4cfeddc5e6146f6ccdbb9ddc232b07 /idatui/app.py
parentapp: drop the Header (keep the Footer); rpc: function-scope xrefs_from (diff)
downloadida-tui-3b4e397f48e4519c6b5a24fede2e41707e355a92.tar.gz
ida-tui-3b4e397f48e4519c6b5a24fede2e41707e355a92.tar.xz
ida-tui-3b4e397f48e4519c6b5a24fede2e41707e355a92.zip
app: comment on a no-address line -> function comment (was refused)
Pressing ';' on the decompiler's signature or local-declaration lines did nothing ('no address on this line to comment') because those lines carry no /*0xEA*/ marker. Fall back to the current function's entry ea so commenting the header annotates the function itself; the prompt says 'function comment @ ...'. Body-line comments are unchanged. New scenario comment_func locks it (suite 104 green).
Diffstat (limited to 'idatui/app.py')
-rw-r--r--idatui/app.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/idatui/app.py b/idatui/app.py
index 086785c..8fc259e 100644
--- a/idatui/app.py
+++ b/idatui/app.py
@@ -2380,14 +2380,22 @@ class IdaTui(App):
def on_comment_requested(self, msg: CommentRequested) -> None:
ea = self._line_ea_for(msg.view)
+ # Signature / local-declaration lines carry no address; fall back to the
+ # function's entry ea so commenting the header annotates the function.
+ func_level = ea is None
+ if func_level:
+ ea = self._cur.ea if self._cur else None
if ea is None:
self._status("no address on this line to comment")
return
- existing = self._existing_comment(msg.view)
+ existing = "" if func_level else self._existing_comment(msg.view)
self._comment_ctx = (msg.view, ea, existing)
self.query_one("#status", Static).display = False
inp = self.query_one("#comment", Input)
- inp.placeholder = f"comment @ {ea:#x} — Enter=apply (empty=clear) Esc=cancel"
+ inp.placeholder = (
+ f"function comment @ {ea:#x} — Enter=apply (empty=clear) Esc=cancel"
+ if func_level else
+ f"comment @ {ea:#x} — Enter=apply (empty=clear) Esc=cancel")
inp.can_focus = True
inp.display = True
inp.value = existing