diff options
| author | blasty <blasty@local> | 2026-07-24 00:05:55 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-24 00:05:55 +0200 |
| commit | 7337bb9e6cbb6ea554e1a155098a19390b9ba45f (patch) | |
| tree | d4a1a3dc0504da0698a0bd17b107f3ca793ac25c /idatui | |
| parent | ux: label the startup wait as auto-analysis, not "starting a server" (diff) | |
| download | ida-tui-7337bb9e6cbb6ea554e1a155098a19390b9ba45f.tar.gz ida-tui-7337bb9e6cbb6ea554e1a155098a19390b9ba45f.tar.xz ida-tui-7337bb9e6cbb6ea554e1a155098a19390b9ba45f.zip | |
nav: land the decompiler cursor on the function name, not column 0
Jumping to a function in the decompiler (follow/xref into pseudocode) parked the
cursor at column 0 of the prototype line. Now it lands on the function's name in
the prototype instead, mirroring the listing's ref-column behavior.
_do_navigate's prefer_decomp branch: when the target is the function itself
(ea == fn.addr) it uses the prototype line (0) and computes the name's column via
_decomp_col_for; a mid-function target uses the ea-matched line (name column when
present, else 0). The column rides through _open_decomp_entry -> NavEntry
.dec_cursor_x -> _apply_decomp's view.show(cursor_x=...).
Verified: following sub_2060 from pseudocode lands on line 0, cursor_x=28, which
is exactly 'sub_2060' in "unsigned __int64 __fastcall sub_2060(int a1)".
decomp_nav/decomp_follow_self/xref_labels/view_toggle/disasm_nav/search/mouse/
listing_view/continuous_view/func_banners/rename green (follow_xrefs is a
pre-existing ordering flake; passes in isolation).
Diffstat (limited to 'idatui')
| -rw-r--r-- | idatui/app.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/idatui/app.py b/idatui/app.py index 6e9388f..beb1d47 100644 --- a/idatui/app.py +++ b/idatui/app.py @@ -3573,9 +3573,15 @@ class IdaTui(App): if prefer_decomp and fn is not None: dec = self.program.decompile(fn.addr) if not dec.failed and dec.code: - dec_idx = self._decomp_line_for(fn.addr, ea) + if ea == fn.addr: + # Jumping to the function itself: land on its name in the + # prototype (line 0), not column 0. + dec_idx = 0 + else: + dec_idx = max(self._decomp_line_for(fn.addr, ea), 0) + col = self._decomp_col_for(fn.addr, dec_idx, fn.name) self.app.call_from_thread( - self._open_decomp_entry, fn.addr, fn.name, max(dec_idx, 0), push) + self._open_decomp_entry, fn.addr, fn.name, dec_idx, col, push) return # Otherwise: everything opens the one continuous listing at ``ea``. A # function name is used for the status label; a region gets a segment @@ -3587,9 +3593,9 @@ class IdaTui(App): self._open_at, ea, name, idx, push, -1, 0, fn is None, focus_name) def _open_decomp_entry(self, fn_addr: int, fn_name: str, dec_idx: int, - push: bool) -> None: + dec_cursor_x: int, push: bool) -> None: """Open ``fn_addr`` in the decompiler as a real navigation (nav history - aware), landing on pseudocode line ``dec_idx``.""" + aware), landing on pseudocode line ``dec_idx`` column ``dec_cursor_x``.""" if push: # Snapshot where we jumped from so 'back' returns there. If that was # the pseudocode (F5 makes a transient _cur not yet on the stack), @@ -3607,7 +3613,7 @@ class IdaTui(App): self._save_current_pos() self._decomp_return = None # a real navigation abandons the F5 return entry = NavEntry(ea=fn_addr, name=fn_name, view="decomp", - dec_cursor=dec_idx) + dec_cursor=dec_idx, dec_cursor_x=dec_cursor_x) if push: self._nav.append(entry) self._open_entry(entry, push=False) |
