aboutsummaryrefslogtreecommitdiffstats
path: root/TODO
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-07-26 12:50:52 +0200
committerblasty <blasty@local>2026-07-26 12:50:52 +0200
commitb59c892c9469eed1a2fc416037500a32d8229259 (patch)
tree26129476b586a3007a8ea11e72766bd0263606df /TODO
parentasm highlighting: park the work with its findings (not merged) (diff)
downloadida-tui-b59c892c9469eed1a2fc416037500a32d8229259.tar.gz
ida-tui-b59c892c9469eed1a2fc416037500a32d8229259.tar.xz
ida-tui-b59c892c9469eed1a2fc416037500a32d8229259.zip
listing: syntax-highlight assembly from IDA's own token tags
The listing showed the mnemonic bright and every operand in one body colour. IDA already classifies each token, for every processor it supports: generate_disasm_line() emits \x01<tag>text\x02<tag> and the tag says what the text IS. We were calling tag_remove() and throwing that away. So: no lexer. A pygments asm lexer would be a worse guess and would need one dialect per architecture — this is arch-correct for free, including the ARM/MIPS blobs the loader work just made openable. lea rcx, function; "usage" insn reg punct name cmt _idatui_spans() parses the tags into [[kind, text], ...], heads rows carry "spans", Head.spans holds them, and _span_segments() renders them with a fallback to the old mnemonic/rest split for older workers. Palette rule: NEUTRALS for the machine (mnemonic brightest — it's the column you scan; registers at body weight because they're most of the text), HUES only where they mean something (numbers, strings, symbols), structure recedes so commas and brackets stop competing with operands. Two things that fail SILENTLY and are now encoded: * The constants are SCOLOR_DATNAME / SCOLOR_CODNAME. There is no SCOLOR_DNAME — a wrong guess leaves the tag unmapped, symbols render as plain body text, and nothing tells you why. Probed the live IDA to get the real names. * Spans must be whitespace-collapsed exactly as `text` is, walking characters rather than per span, because a run of IDA's column padding straddles span boundaries. A row only gets spans when they reconstruct `text` exactly, so a mismatch degrades to the old rendering instead of corrupting the line. The reason this was parked yesterday was NOT a bug in it. listing_view's "undefining a data head yields an unknown run" waits for `index_of_ea(dea) >= 0` — but dea is the head it just undefined, so it is in the OLD model too and the predicate passes instantly, asserting against pre-edit rows. It only ever passed because the model swap won the race; spans made pages 3x bigger, the swap lost, and the check accused working code. It now waits for the model to be REPLACED. Cost measured on libcrypto: 95KB per 500-row page, 50ms; model ensure(2000) 228ms. Acceptable for what it buys. tests: new asm_highlight scenario (+7) — >90% of code rows carry spans, insn/reg/ punct present, every span kind has a style, spans reconstruct the row text exactly, mnemonic is the first span. 202/0 scenarios, 26/0 blob, 30/0 project UI. TODO: DisasmView appears to be dead code (never instantiated; Ctx.dis returns ListingView), which is why this only needed doing once.
Diffstat (limited to 'TODO')
-rw-r--r--TODO45
1 files changed, 8 insertions, 37 deletions
diff --git a/TODO b/TODO
index 78568ae..a97cb4f 100644
--- a/TODO
+++ b/TODO
@@ -91,42 +91,13 @@ before trusting a failure that appeared without a code change.
Coverage for "an edit must not move the view" lives in tests/test_blob_ui.py,
which builds its own throwaway binary and can mutate freely.
-## Assembly syntax highlighting (WIP, patch in docs/wip-asm-spans.patch)
+## DisasmView looks like dead code
-The listing shows the mnemonic bright and everything after it in one body
-colour. IDA already classifies every token, for every processor, so there is
-nothing to lex — generate_disasm_line() emits \x01<tag>text\x02<tag> and the tag
-says what the text IS. A pygments asm lexer would be a worse guess and would
-need a dialect per architecture.
+idatui/app.py defines DisasmView (Line-based, function-scoped) but the app never
+instantiates or queries it — the unified ListingView replaced it, and even the
+test harness's `Ctx.dis` returns ListingView. DisasmModel is still used, but only
+to compute indices in _do_edit_item, never to render.
-The patch: _idatui_spans() in patch_server parses those tags into
-[[kind, text], ...] (insn/reg/num/str/name/seg/cmt/punct), heads rows carry
-"spans", Head.spans holds them, and ListingView renders via _span_segments()
-with a fallback to today's mnemonic/rest split. Verified working on echo:
-
- lea rcx, function; "usage" -> insn text reg punct text name cmt
- coverage over 400 rows: insn 344, reg 402, punct 397, name 156, num 47, cmt 44
-
-Palette rule used: NEUTRALS for the machine (mnemonic brightest, registers at
-body weight since they are most of the text), HUES only where they carry meaning
-(numbers, strings, symbols), structure recedes so commas and brackets stop
-competing with operands.
-
-Two things learned that the patch encodes:
-* The constants are SCOLOR_DATNAME / SCOLOR_CODNAME — there is no SCOLOR_DNAME.
- Guessing fails SILENTLY: an unmapped tag renders as body text, so symbols just
- aren't blue and nothing says why.
-* Spans must be whitespace-collapsed exactly as `text` is, walking characters
- rather than per-span, because a run of spaces straddles spans. The row only
- gets spans when the two agree, so a mismatch degrades instead of corrupting.
-
-NOT MERGED because it breaks one check: listing_view "undefining a data head
-yields an unknown run" now reports kind=data. Reproducible, and bisected to this
-change (10/0 with it stashed, 9/1 with it applied) on a fresh .i64. Cause not yet
-found — the span code doesn't touch `kind`, which is computed from the flags
-before spans are attached, so the suspicion is that adding "spans" to the row
-dict perturbs something in the undefine path's re-read (caching keyed on the row
-shape?). Find that before merging.
-
-Also still plain: DisasmView (the function-scoped view) renders Line objects from
-the `disasm` tool, which doesn't emit spans. Same treatment needed there.
+Worth confirming and deleting: it's ~180 lines carrying its own rendering,
+search and cursor logic that no longer runs, and it misled me into thinking
+assembly highlighting needed doing twice.