mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Wrap decisions measured inline |T icons as ~0 (the tokenizer hook), so icon-bearing chat lines broke as if the icons weren't there and the emitter's real advances ran past the frame's right edge. Choke: FUN_TEXT_WRAP_STEPPER (0x005C7260), the wrap-stepper dispatcher that lays out one wrapped line per call. Its exactly 4 callers are every wrap consumer - the draw builder (render breaks), the height measure (GetStringHeight), the chars-that-fit counter (ellipsis), and the break-array computer - so one co-hook keeps render, height, truncation, and break arrays mutually consistent. outBreak and outNext-text are byte counts (==len means "all fit"); outWidth is the measured icons-at-zero line width in the caller's units. The hook shrinks the wrapWidth argument by a minimal feasible shrink, found by probing the stepper sandboxed (local out-params + a copy of the p10 first-line state byte): feasible(s) iff the line's icon advances fit in the shrink plus the spare the break left (iconSum <= s + probeW - outWidth). s=0 feasible -> no shrink (the common fits-anyway case); otherwise escalate by the measured deficit, then bisect the [infeasible, feasible] bracket to a quarter-glyph (<=8 probes). Never overflows; packs each line to its physical capacity. Gated on the shared InlineInterceptActive predicate + the editbox flag bit 0x40 the dispatcher already carries. Unit trap #2 (cost one flight): each caller passes fontH/wrapWidth in its OWN space - node text units from the builder, the small anchor-converted space from the fs-level callers chat wraps through. px -> caller units = fontH / FUN_TEXT_FONT_HEIGHT(flag, fontH), the engine's own pixel realization of the fontH param (FUN_005C6940's final scale proves the convention for every gxu caller). Rejected en route (documented in docs/InlineTextureEscapes.md): raw-px subtraction (shredded lines to 2-glyph fragments), whole-remaining- text sums (8-icon line -> one word per line), icon-count fixed-point iteration (oscillates - 55-byte zero-width escapes make the break<->count coupling discontinuous), max/average tiebreaks. Cross-checked against 4.3.4 (renders |T natively): Blizzard extended the token contract instead - texture token type 7 + a shared parser (FUN_00617ba0) called inline by all five layout loops, fontH passed in for :0 defaults, plain width, no padding. No single-choke trick exists at source level; the probe search is the 1.12-shaped equivalent. Diagnostics: _classicapi_InlineTexWrap(n) dumps the last 8 icon-bearing calls (widths, per-probe sums/breaks/raw out-params, final shrink, floor hits).