aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-09 14:17:20 +0200
committerblasty <blasty@local>2026-07-09 14:17:20 +0200
commit29326c9c88a62532fd5aeb76302075ab138c5887 (patch)
treecab35eee55256dd4565f18f878b9a97aabe79081 /tests
parentcolumn cursor: real left/right movement + follow the ref UNDER the cursor (diff)
downloadida-tui-29326c9c88a62532fd5aeb76302075ab138c5887.tar.gz
ida-tui-29326c9c88a62532fd5aeb76302075ab138c5887.tar.xz
ida-tui-29326c9c88a62532fd5aeb76302075ab138c5887.zip
mouse: click to place cursor, double-click to follow
- ColumnCursor.on_click maps the click to a virtual (line, column) via event.get_content_offset (handles padding/border) + scroll_offset, then places the line+column cursor (disasm posts CursorMoved for the status line). - double-click (event.chain>=2) = place cursor + follow the symbol under it, identical to selecting it and pressing Enter. - works in both views (verified: disasm click on 'call sub_XXXX' lands on the exact token; pseudocode click maps columns with no padding). - pilot suite 36/36.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tui.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_tui.py b/tests/test_tui.py
index 22d50b1..ef0ffb2 100644
--- a/tests/test_tui.py
+++ b/tests/test_tui.py
@@ -293,6 +293,43 @@ async def run(db):
check("follows the symbol under the cursor",
app._cur.ea == want, f"cur={app._cur.ea:#x} want={want:#x}")
+ # Mouse: single click places the cursor; double-click follows.
+ table.focus()
+ table.move_cursor(row=biggest_i)
+ await pilot.press("enter")
+ await wait_until(pilot, lambda: dis.total > 0, timeout=20)
+ dis.focus()
+ await pilot.pause(0.2)
+ mrow = mcol = msym = mline = None
+ for _ in range(40): # page down until a 'call sub_' is on screen
+ top = round(dis.scroll_offset.y)
+ dis.model.lines(top, dis.size.height + 2, prefetch=False)
+ for r in range(min(dis.size.height, dis.total - top)):
+ plain = dis._line_plain(top + r)
+ if plain and "call" in plain:
+ mm = re.search(r"\b(sub_[0-9A-Fa-f]+)", plain)
+ if mm:
+ mrow, mcol, msym, mline = r, mm.start(1), mm.group(1), top + r
+ break
+ if mrow is not None:
+ break
+ await pilot.press("pagedown")
+ await pilot.pause(0.05)
+ if mrow is None:
+ check("found a call line for the mouse test", False, "no visible call sub_")
+ else:
+ await pilot.click(dis, offset=(mcol + 1, mrow)) # +1: left padding
+ await pilot.pause(0.1)
+ check("single click places the cursor on the clicked token",
+ dis.cursor == mline and dis.word_under_cursor() == msym,
+ f"cursor={dis.cursor} (want {mline}) word={dis.word_under_cursor()!r}")
+ depth = len(app._nav)
+ want = app.program.resolve(msym)
+ await pilot.click(dis, offset=(mcol + 1, mrow), times=2)
+ await wait_until(pilot, lambda: len(app._nav) > depth, timeout=25)
+ check("double-click follows the symbol", app._cur.ea == want,
+ f"cur={app._cur.ea:#x} want={want:#x}")
+
def main(argv):
db = None