From 3b4e397f48e4519c6b5a24fede2e41707e355a92 Mon Sep 17 00:00:00 2001 From: blasty Date: Fri, 10 Jul 2026 16:12:22 +0200 Subject: 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). --- idatui/app.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'idatui') 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 -- cgit v1.3.1-sl0p