aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-23 22:19:03 +0200
committerblasty <blasty@local>2026-07-23 22:19:03 +0200
commite7438b9d06c1d92398ba6535d9f115ada26ea875 (patch)
treed1d46ffc7770d371e7d1f46711a617001c7b5b06
parentlisting: keep a few lines of context above a jump target (diff)
downloadida-tui-e7438b9d06c1d92398ba6535d9f115ada26ea875.tar.gz
ida-tui-e7438b9d06c1d92398ba6535d9f115ada26ea875.tar.xz
ida-tui-e7438b9d06c1d92398ba6535d9f115ada26ea875.zip
listing: on-screen jumps just move the cursor, don't re-scroll
Extend the jump-context behaviour: if the target is already visible in the current viewport (same listing model, cursor index within [top, top+height)), leave the scroll offset untouched and only move the cursor to the target. Only off-screen jumps re-scroll (target parked _JUMP_CONTEXT lines below the top). Verified: an in-viewport jump keeps scroll_top constant while moving the cursor onto the target; off-screen jumps still get the 4-line context margin. scroll_restore/disasm_nav/follow_xrefs/xref_labels/mouse/search/listing_view/ continuous_view/func_banners 54/0.
-rw-r--r--idatui/app.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/idatui/app.py b/idatui/app.py
index bce8fe8..90f1a83 100644
--- a/idatui/app.py
+++ b/idatui/app.py
@@ -3683,15 +3683,21 @@ class IdaTui(App):
# Unified model: the code view is always the continuous listing,
# positioned at this entry. The decompiler is a per-function toggle
# (F5/Tab -> _decomp_from_listing), never opened implicitly.
+ lst = self.query_one(ListingView)
lm = self.program.listing(entry.ea)
sy = entry.scroll_y if entry.scroll_y >= 0 else None
if lm is not None:
if sy is None:
# Fresh jump (not a back/forward restore, which carries its own
- # scroll): keep a few lines of context above the target instead
- # of parking it on the very top row. Cursor stays on the target.
- sy = max(entry.cursor - _JUMP_CONTEXT, 0)
- self.query_one(ListingView).load(
+ # scroll). If the target is already on-screen in the SAME listing,
+ # leave the viewport alone and just move the cursor; otherwise
+ # scroll so the target sits a few lines below the top for context.
+ top = round(lst.scroll_offset.y)
+ if lst.model is lm and top <= entry.cursor < top + lst._visible_height():
+ sy = top
+ else:
+ sy = max(entry.cursor - _JUMP_CONTEXT, 0)
+ lst.load(
lm, entry.name, cursor=entry.cursor,
cursor_x=entry.cursor_x, scroll_y=sy)
self._active = "listing"