aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-09 21:18:24 +0200
committerblasty <blasty@local>2026-07-09 21:18:24 +0200
commitd7003527f15398e8bed4227c07302489c650fa2b (patch)
treeedce0fcb1695442c4a73a9909511b3bde80ccc62 /tests
parentdecompiler: hide the per-line /*0xEA*/ address markers (clutter) (diff)
downloadida-tui-d7003527f15398e8bed4227c07302489c650fa2b.tar.gz
ida-tui-d7003527f15398e8bed4227c07302489c650fa2b.tar.xz
ida-tui-d7003527f15398e8bed4227c07302489c650fa2b.zip
decompiler: xref jump within the current function moves the cursor
The earlier xref->pseudocode-line fix only worked when the jump target was in a DIFFERENT function (which reloads the pane). When the target was inside the function already displayed, _show_active skipped the reload -> and never applied the new dec_cursor, so the cursor stayed put (the reported 'jumping to xref in decompile view doesn't work'; most xrefs land in the shown function). _open_entry now detects the already-loaded case and repositions the decompiler via a new DecompView.goto (moves cursor/scroll on the loaded text, no re-highlight). Toggle (Tab) still goes through _show_active untouched. Add a same-function xref-jump pilot check. full suite 64/64.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tui.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_tui.py b/tests/test_tui.py
index 2f80270..1641368 100644
--- a/tests/test_tui.py
+++ b/tests/test_tui.py
@@ -383,6 +383,25 @@ async def run(db):
await pilot.pause(0.1)
check("xref-select lands on the reference LINE in pseudocode",
dec.cursor == dexp, f"dec.cursor={dec.cursor} want={dexp}")
+
+ # And a jump whose target is INSIDE the already-displayed
+ # function must still move the cursor (the decompiler pane
+ # isn't reloaded in that case, so it needs explicit repos).
+ anch = [(i, dec._line_ea(i)) for i in range(len(dec._texts))
+ if dec._line_ea(i) is not None]
+ if len(anch) >= 4:
+ start_ln = anch[1][0]
+ far_ea = anch[len(anch) // 2][1]
+ exp2 = app._decomp_line_for(app._cur.ea, far_ea)
+ dec.focus()
+ dec.cursor = start_ln
+ dec.refresh()
+ await pilot.pause(0.05)
+ app._on_xref_chosen(far_ea) # target within this function
+ await wait_until(pilot, lambda: dec.cursor == exp2, timeout=20)
+ check("xref-select moves the cursor within the same function",
+ dec.cursor == exp2 and exp2 != start_ln,
+ f"dec.cursor={dec.cursor} want={exp2} start={start_ln}")
app._active = "disasm" # restore for the following blocks
app._show_active()
await pilot.pause(0.05)