diff options
| author | blasty <blasty@local> | 2026-07-09 12:14:18 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-09 12:14:18 +0200 |
| commit | d6422f9eacf914172653c361a141e16497a81d27 (patch) | |
| tree | fa6c63cba45e1881bfb37fc18f5db75b0fe78485 | |
| parent | Phase 1 TUI: two-pane functions<->disasm, virtualized listing, nav backbone (diff) | |
| download | ida-tui-d6422f9eacf914172653c361a141e16497a81d27.tar.gz ida-tui-d6422f9eacf914172653c361a141e16497a81d27.tar.xz ida-tui-d6422f9eacf914172653c361a141e16497a81d27.zip | |
add Ctrl+B toggle to show/hide the functions pane
- action_toggle_functions: collapse/restore left pane, disasm takes full width;
focus follows (disasm when hidden, table when shown)
- pilot test covers the toggle (11/11)
| -rw-r--r-- | idatui/app.py | 10 | ||||
| -rw-r--r-- | tests/test_tui.py | 15 |
2 files changed, 24 insertions, 1 deletions
diff --git a/idatui/app.py b/idatui/app.py index 81e3fac..a91b3f0 100644 --- a/idatui/app.py +++ b/idatui/app.py @@ -242,6 +242,7 @@ class IdaTui(App): Binding("q", "quit", "Quit"), Binding("slash", "filter", "Filter"), Binding("g", "goto", "Goto"), + Binding("ctrl+b", "toggle_functions", "Names"), Binding("tab", "toggle_focus", "Switch pane"), Binding("escape", "back", "Back"), ] @@ -341,6 +342,15 @@ class IdaTui(App): table.add_row(f"{f.addr:08X}", f.name, f"{f.size:#x}", key=str(f.addr)) # -- actions ----------------------------------------------------------- # + def action_toggle_functions(self) -> None: + """Show/hide the functions pane; give the disasm view all the width.""" + left = self.query_one("#left", FunctionsPanel) + left.display = not left.display + if not left.display: + self.query_one(DisasmView).focus() + else: + self.query_one("#func-table", DataTable).focus() + def action_toggle_focus(self) -> None: table = self.query_one("#func-table", DataTable) if self.focused is table: diff --git a/tests/test_tui.py b/tests/test_tui.py index 752f72f..8769321 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -12,7 +12,7 @@ import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from idatui.app import DisasmView, IdaTui # noqa: E402 +from idatui.app import DisasmView, FunctionsPanel, IdaTui # noqa: E402 from textual.widgets import DataTable, Static # noqa: E402 PASS = FAIL = 0 @@ -111,6 +111,19 @@ async def run(db): ) check("filter narrowed the list", filtered, f"rows={table.row_count} of {nfuncs}") + # Toggle the functions pane show/hide. + left = app.query_one("#left", FunctionsPanel) + await pilot.press("ctrl+b") + await pilot.pause(0.1) + check("ctrl+b hides functions pane + focuses disasm", + not left.display and isinstance(app.focused, DisasmView), + f"display={left.display} focus={type(app.focused).__name__}") + await pilot.press("ctrl+b") + await pilot.pause(0.1) + check("ctrl+b again restores pane + focuses table", + left.display and isinstance(app.focused, DataTable), + f"display={left.display} focus={type(app.focused).__name__}") + def main(argv): db = None |
