summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblasty <peter@haxx.in>2026-07-25 15:06:19 +0200
committerblasty <peter@haxx.in>2026-07-25 15:06:19 +0200
commitb2da4886db14defad982d849725df7a7488356d4 (patch)
tree928a8357dbed9e27003da75b5774878ffc609a21
parentpalette: cap project-scope results at 60 (mitigation for sluggish arrowing) (diff)
downloadida-tui-b2da4886db14defad982d849725df7a7488356d4.tar.gz
ida-tui-b2da4886db14defad982d849725df7a7488356d4.tar.xz
ida-tui-b2da4886db14defad982d849725df7a7488356d4.zip
projects: open the Ctrl+O switcher on the binary you're already in
It always highlighted row 0, so switching away and back meant hunting for your current position in the list. Preselect the entry marked active instead; if a filter excludes it, fall back to the first row as before. Locked in test_project_ui.py (21 checks).
-rw-r--r--idatui/app.py5
-rw-r--r--tests/test_project_ui.py9
2 files changed, 12 insertions, 2 deletions
diff --git a/idatui/app.py b/idatui/app.py
index f9ddfea..9ef0c47 100644
--- a/idatui/app.py
+++ b/idatui/app.py
@@ -2474,7 +2474,10 @@ class ProjectPalette(ModalScreen):
opts.append(Option(label))
ol.add_options(opts)
if rows:
- ol.highlighted = 0
+ # Land on the binary you're already in, so the switcher opens where
+ # you are rather than at whatever sorts first.
+ active = next((i for i, e in enumerate(rows) if e["active"]), 0)
+ ol.highlighted = active
self.query_one("#pal-title", Static).update(
f" binaries: {len(rows)} of {len(self._entries)}")
diff --git a/tests/test_project_ui.py b/tests/test_project_ui.py
index 8a0fd2b..e3bfb62 100644
--- a/tests/test_project_ui.py
+++ b/tests/test_project_ui.py
@@ -18,7 +18,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from idatui._sync import wait_for # noqa: E402
from idatui.app import IdaTui, ProjectPalette # noqa: E402
from idatui.project import Project # noqa: E402
-from textual.widgets import Input, Static # noqa: E402
+from textual.widgets import Input, OptionList, Static # noqa: E402
PASS = FAIL = 0
@@ -82,6 +82,13 @@ async def run(bins):
check("it marks the other as not yet opened",
any(not e["resident"] and e["label"] == second
for e in pal._results))
+ ol = pal.query_one(OptionList)
+ check("the switcher opens on the binary you're already in",
+ ol.highlighted is not None
+ and pal._results[ol.highlighted]["label"] == first,
+ f"highlighted={ol.highlighted} "
+ f"={pal._results[ol.highlighted]['label'] if ol.highlighted is not None else None} "
+ f"want={first}")
# -- switch to the second binary -------------------------------- #
pal.query_one(Input).value = second