From 55b726d780404d77fe781b6cc08a4b3f4a039b0c Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 9 Jul 2026 13:34:43 +0200 Subject: function-name filter: incremental + highlight + clear - Incremental client-side filter over the cached function list (no per-keystroke server round-trips): narrows + highlights the matched substring in each name as you type, debounced ~80ms. Substring or glob (*/?), smartcase. - Clear the filter: Esc in the filter box, OR Esc on the focused list, OR empty Enter. Status shows 'filter : N/total'. - streaming pauses while a filter is active; re-applied over the full set once load completes. Row selection resolves the name from the index (cells can now be styled Text). - FunctionIndex.all_loaded(); pilot suite 27/27. --- tests/test_tui.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/test_tui.py b/tests/test_tui.py index 2156fad..2aaf8ff 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -14,6 +14,7 @@ import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from idatui.app import DecompView, DisasmView, FunctionsPanel, IdaTui # noqa: E402 from textual.widgets import DataTable, Input, Static # noqa: E402 +from rich.text import Text # noqa: E402 PASS = FAIL = 0 @@ -199,6 +200,33 @@ async def run(db): status.display and not si.display and not dis._matches, f"status={status.display} si={si.display} m={len(dis._matches)}") + # Incremental function-name filter + highlight + Esc-clear. + table.focus() + await pilot.pause(0.1) + if app._filter_term: # clear any leftover filter from earlier + await pilot.press("escape") + await pilot.pause(0.2) + full = table.row_count + await pilot.press("slash") + await pilot.pause(0.2) + for ch in "sub_": + await pilot.press(ch) + await pilot.pause(0.1) + await pilot.pause(0.2) + check("filter narrows incrementally as you type", + 0 < table.row_count < full, f"{table.row_count}/{full}") + cell = table.get_row_at(0)[1] + check("filter highlights matched substring in name", + isinstance(cell, Text) and any(s.style for s in cell.spans), repr(str(cell))) + await pilot.press("enter") + await pilot.pause(0.2) + check("Enter keeps filter + focuses table", + isinstance(app.focused, DataTable) and table.row_count < full) + await pilot.press("escape") + await pilot.pause(0.3) + check("Esc on the list clears the filter", table.row_count == full, + f"{table.row_count}/{full}") + def main(argv): db = None -- cgit v1.3.1-sl0p