fix(ui): restore threaded rendering on macOS#539
Conversation
Greptile SummaryThis PR addresses two compounding startup-latency regressions introduced across v0.14–v0.17. The first fix removes the explicit
Confidence Score: 4/5Safe to merge; both changes are narrow and conservative — the renderer default is restored to a previously working state, and the measurement fast path always falls back to the existing Unicode scanner when the patch contains any non-ASCII content. The logic in
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[maxFileCodeLineWidth called] --> B{Cached?}
B -- yes --> C[Return cached width]
B -- no --> D[Fetch deletionLines & additionLines]
D --> E{hasOnlySimpleCodeLines}
E --> F{file.patch non-empty?}
F -- yes --> G{simplePatchTextRegex test\nASCII + tab + newline only?}
G -- yes --> H[measureLine = measureSimpleCodeLineWidth\nuse .length after tab expansion]
G -- no --> I[measureLine = measureRenderedCodeLineWidth\nmeasureTextWidth Unicode scan]
F -- no --> J{every deletionLine\npasses simpleCodeLineRegex?}
J -- yes --> K{every additionLine\npasses simpleCodeLineRegex?}
K -- yes --> H
K -- no --> I
J -- no --> I
H --> L[Iterate deletionLines & additionLines\ntrack maxWidth]
I --> L
L --> M[Cache & return maxWidth]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[maxFileCodeLineWidth called] --> B{Cached?}
B -- yes --> C[Return cached width]
B -- no --> D[Fetch deletionLines & additionLines]
D --> E{hasOnlySimpleCodeLines}
E --> F{file.patch non-empty?}
F -- yes --> G{simplePatchTextRegex test\nASCII + tab + newline only?}
G -- yes --> H[measureLine = measureSimpleCodeLineWidth\nuse .length after tab expansion]
G -- no --> I[measureLine = measureRenderedCodeLineWidth\nmeasureTextWidth Unicode scan]
F -- no --> J{every deletionLine\npasses simpleCodeLineRegex?}
J -- yes --> K{every additionLine\npasses simpleCodeLineRegex?}
K -- yes --> H
K -- no --> I
J -- no --> I
H --> L[Iterate deletionLines & additionLines\ntrack maxWidth]
I --> L
L --> M[Cache & return maxWidth]
|
acefd26 to
977f179
Compare
Summary
Why
Hunk enters the alternate screen before React builds and emits the first complete review frame. That makes the issue's long blank-screen interval consistent with first-frame renderer work blocking the main thread rather than Git loading.
OpenTUI 0.4.3 defaults
useThreadtotrue, then explicitly turns it off on Linux. Hunk currently passesuseThread: false, overriding the optimized macOS default. Removing that override delegates the platform choice back to OpenTUI and should move macOS renderer output off the main thread again.This PR deliberately does not change code-column measurement or claim to explain the older v0.14 regression. It addresses the clear v0.17-era macOS threading regression independently so it can be tested in the reporter's Kitty environment.
Validation
bun run typecheckbun run lintbun run format:checkbun run test:integrationbun run test:tty-smokeLinux is unchanged because OpenTUI disables threaded rendering there. Final validation therefore requires comparing this branch against v0.17.0 in Kitty on macOS.
Refs #534
This PR description was generated by Pi using OpenAI GPT-5.4