feat: SUB header line in Diff tab now linked to corresponding hex dump.
This commit is contained in:
@@ -743,6 +743,16 @@ class AnalyzerPanel(tk.Frame):
|
||||
except (IndexError, ValueError):
|
||||
pass
|
||||
|
||||
def _find_frame_by_sub(self, sess_idx: int, sub: int, page_key: int) -> Optional[AnnotatedFrame]:
|
||||
"""Find a frame in a session by (sub, page_key) — used for diff click-through."""
|
||||
if sess_idx >= len(self.state.sessions):
|
||||
return None
|
||||
sess = self.state.sessions[sess_idx]
|
||||
for af in sess.bw_frames + sess.s3_frames:
|
||||
if af.header and af.header.sub == sub and af.header.page_key == page_key:
|
||||
return af
|
||||
return None
|
||||
|
||||
def _find_frame(self, sess_idx: int, frame_idx: int, source: str) -> Optional[AnnotatedFrame]:
|
||||
if sess_idx >= len(self.state.sessions):
|
||||
return None
|
||||
@@ -792,9 +802,28 @@ class AnalyzerPanel(tk.Frame):
|
||||
self._tw(w, " No changes detected.\n", "dim")
|
||||
else:
|
||||
self._tw(w, f"DIFF vs SESSION {idx-1}\n", "head")
|
||||
self._tw(w, " (click any SUB header to open its hex dump)\n", "dim")
|
||||
for fd in diffs:
|
||||
pg = f" (page {fd.page_key:04X})" if fd.page_key else ""
|
||||
self._tw(w, f"\n SUB {fd.sub:02X} ({fd.sub_name}){pg}:\n", "addr")
|
||||
link_tag = f"difflink_{fd.sub}_{fd.page_key}"
|
||||
w.configure(state="normal")
|
||||
start = w.index(tk.INSERT)
|
||||
w.insert(tk.END, f"\n SUB {fd.sub:02X} ({fd.sub_name}){pg}:\n")
|
||||
end = w.index(tk.INSERT)
|
||||
w.tag_add("addr", start, end)
|
||||
w.tag_add(link_tag, start, end)
|
||||
w.tag_configure(link_tag, underline=True)
|
||||
# capture fd values for the closure
|
||||
def _make_handler(s=idx, sub=fd.sub, pk=fd.page_key):
|
||||
def _handler(event):
|
||||
af = self._find_frame_by_sub(s, sub, pk)
|
||||
if af:
|
||||
self._show_frame_detail(s, af.frame.index, af.source)
|
||||
return _handler
|
||||
w.tag_bind(link_tag, "<Button-1>", _make_handler())
|
||||
w.tag_bind(link_tag, "<Enter>", lambda e, t=link_tag: w.configure(cursor="hand2"))
|
||||
w.tag_bind(link_tag, "<Leave>", lambda e: w.configure(cursor=""))
|
||||
w.configure(state="disabled")
|
||||
for bd in fd.diffs:
|
||||
b = f"{bd.before:02x}" if bd.before >= 0 else "--"
|
||||
a = f"{bd.after:02x}" if bd.after >= 0 else "--"
|
||||
|
||||
Reference in New Issue
Block a user