diff options
| author | blasty <blasty@local> | 2026-07-25 21:29:37 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-25 21:29:37 +0200 |
| commit | f0a30e2f1bfca81753a0807262de9901005d8a6a (patch) | |
| tree | 9d9ffe27722ae86c7fc03ec33b06e5a593a21143 /tests | |
| parent | palette: match case-insensitively in BOTH directions (diff) | |
| download | ida-tui-f0a30e2f1bfca81753a0807262de9901005d8a6a.tar.gz ida-tui-f0a30e2f1bfca81753a0807262de9901005d8a6a.tar.xz ida-tui-f0a30e2f1bfca81753a0807262de9901005d8a6a.zip | |
nav: don't stack a history entry for the place you're already standing on
Walking back with Esc ended in a dead keypress: nav_depth dropped but the screen
didn't change. Measured on a live pane, four Escs after one follow:
Esc #1 -> sub_3500 L7 (where we followed from) good
Esc #2 -> main L54 decomp (where we followed from) good
Esc #3 -> main L344 listing good
Esc #4 -> main L344 listing -- nav 2 -> 1, nothing moved
The app auto-lands on main at startup, and opening main again from Ctrl+N
appended a second, identical entry. Every "navigate to where you already are"
did this; the extra Esc it bought is invisible except that it does nothing, which
is exactly what "back is broken" feels like from the keyboard.
Both push sites now go through _push_nav, which replaces the top entry instead of
appending when the target is the same (ea, view, line) — the newer entry's
metadata still wins. _same_spot compares dec_cursor for pseudocode and cursor for
the listing.
Note what is NOT a duplicate: the first follow after Tab-to-pseudocode still
pushes twice (nav 1 -> 3). That's deliberate — Tab leaves _cur transient and off
the stack, so the follow records the pseudocode position first, which is why Esc
#1 above returns to main L54 rather than dropping you into the listing. Verified
that subsequent follows push exactly one each.
tests: the palette scenario re-opens the function it is already on and asserts
nav depth is unchanged. Fails without the fix (nav 2 -> 3). 194/0.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_scenarios.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_scenarios.py b/tests/test_scenarios.py index 4024c07..becd8b1 100644 --- a/tests/test_scenarios.py +++ b/tests/test_scenarios.py @@ -327,6 +327,21 @@ async def s_palette(c: Ctx): c.check("selecting a palette entry opens that function", bool(app._cur) and app._cur.ea == want, f"cur={app._cur.ea if app._cur else None}") + # Re-open the function we are ALREADY standing on. That used to append an + # identical nav entry, and the extra Esc it bought popped the stack without + # changing anything on screen — a dead keypress, which is precisely what + # "back is broken" feels like from the keyboard. + depth = len(app._nav) + await c.press("ctrl+n") + await c.wait(lambda: isinstance(app.screen, SymbolPalette), 10) + pal2 = app.screen + pal2.query_one(Input).value = "main" + await c.wait(lambda: pal2._results and pal2._results[0][2] == "main", 10) + await c.press("enter") + await c.wait(lambda: not isinstance(app.screen, SymbolPalette), 10) + await c.pause(0.4) + c.check("re-opening the current function doesn't stack a duplicate", + len(app._nav) == depth, f"nav {depth} -> {len(app._nav)}") await c.press("ctrl+n") await c.wait(lambda: isinstance(app.screen, SymbolPalette), 10) await c.press("escape") |
