Repository navigation
fix(workbench): show long tool output on macOS - #6868
Conversation
macOS draws each NSH text into one Core Animation layer, and a layer taller or wider than 16384 pixels shows nothing. A Shell output of about 1200 lines rendered as an empty box at 2x. Code text is now laid out in pieces of 200 lines, each well under the limit. A line wider than 800 columns, with wide characters counted as two, is cut and ends with how many characters are left. The copy buttons still copy the whole recorded text.
EnglishPlease fix the width budget before we merge this. The fixed Using CoreText with the same
Both exceed the 16,384 px limit this change is intended to avoid, so a supported text-size setting can still reach the dimensions responsible for the empty output. These are native font measurements; I have not reproduced the blank result in a window built from this PR. Please account for the maximum supported text scale and the suffix in the final width budget, and verify both an exactly-at-limit line and a truncated line at 130% on a 2x display. The 200-line splitting approach otherwise looks reasonable, and the copy path preserves the original text. 简体中文合并前请先修一下宽度预算。codePieces.ts 固定使用 使用 NSH 相同的
两种都超过了这次改动要避开的 16,384 px 上限,因此使用受支持的字号设置,仍会落入导致输出空白的尺寸范围。这些数据来自原生字体测量;我还没有在基于本 PR 构建的窗口里复现空白结果。 请让最终宽度预算覆盖最大支持字号和省略提示,并在 130% 字号、2x 屏幕下验证“恰好达到列数上限”和“超过上限后被截断”两种输入。其余部分,按 200 行分块的方向可以,复制链路也保留了完整原文。 |
…note At the 130% text size on a 2x display, 800 columns of monospace code text measured about 16,715 px, over the 16,384 px layer limit, and the "more characters" note added more. The budget is now 720 columns with the note included, and emoji and symbols such as ✅, which measure 2.2 columns, count as three. A test ties the budget to the largest size in appearance.ts.
EnglishThanks, you're right on both counts. Fixed in d4985af:
I measured the lines
The widest is 15,044 px, about 8% under 16,384. 200 lines at 130% are 10,400 px tall. Like you, I haven't reproduced the blank or its absence in a window at 130%. These are native measurements of the exact strings. One known gap: a few rare glyphs are wider than the estimate (U+FDFD is about 5 columns, cuneiform about 7.5). A full line would need around 20 of them to reach the limit. 简体中文谢谢,两点都对,已在 d4985af 修复:
我用 CoreText( 和你一样,我没有在 130% 的窗口里复现空白或确认不空白,这些是对实际字符串的原生测量。已知缺口:少数罕见字形比估算更宽(U+FDFD 约 5 列,楔形文字约 7.5 列),一整行要有约 20 个才会达到上限。 |
Cause
macOS draws each NSH text into one Core Animation layer, and a layer taller or wider than the GPU's largest texture (16384 pixels) shows nothing. Tool details put a whole Shell output or file in one text, so on a 2x display an output of about 1200 lines showed as an empty box. A single very long line, such as minified JSON, has the same problem across.
Change
CodeTextlays its text out in pieces of 200 lines (4000 pt tall at 20 pt lines). Line numbers are padded to one width, so the pieces line up as one column.A line wider than one layer is cut and ends with "… N more characters". The budget is 720 columns with that note included, which holds at the largest text size (130%) on a 2x display: one monospace column there measures about 20.9 px, so 720 columns are about 15,050 px. East Asian characters (up to 1.6 columns measured) count as two, and emoji and symbols such as ✅ (2.2 measured) as three. A test ties the budget to the largest size in
appearance.ts. The copy buttons still copy the whole recorded text.One trade-off: a text selection cannot cross from one piece into the next. The copy buttons cover copying everything.
AI use
Diagnosis and the patch were done with Claude Code (Claude Opus 5.5). It found the empty box on a local build, matched it to the layer size limit, and wrote the change and its unit test. I checked the fix on a local build with a long Shell output.