mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 00:49:41 +02:00
fix(tui): fold rare prompt glyphs in the preview so they stop rendering as boxes
A beta tester photographed claude's `❯` prompt and its `⏵⏵` bypass-permissions marker rendering as empty boxes in the preview pane. Their font has no coverage for those codepoints while drawing `·`, `─`, `│` and `▶` perfectly. The glyph TIER cannot help here. It answers "can this terminal do Unicode at all", which is a locale question, and it correctly says yes for exactly the terminals this affects. Coverage is per-glyph and undetectable from inside the process, so the handful of rare glyphs CLIs use as chrome are folded to the ASCII arrows they already look like, and everything a plain font does render is left alone. Scoped tightly: the preview only, never the TUI's own chrome, and skipped entirely at the `nerd` tier where the user has declared a font that can draw anything. The table is short and every entry was seen as tofu in a real terminal rather than guessed at. The fold is length-preserving, so the preview pane's column arithmetic is unaffected.
This commit is contained in:
+7
-2
@@ -50,7 +50,7 @@ import chalk from 'chalk';
|
||||
import { palette, table, tint, type Tone } from '../cli-style.js';
|
||||
import { CODEMAN_INSTANCE, resolveTmuxSocketName } from '../config/instance.js';
|
||||
import { getErrorMessage } from '../types/api.js';
|
||||
import { dropSeveredEscape, toDisplayLines } from './tui-ansi.js';
|
||||
import { dropSeveredEscape, foldPreviewGlyphs, toDisplayLines } from './tui-ansi.js';
|
||||
import { approvalAnswerForKey, newApprovalIds } from './tui-approvals.js';
|
||||
import { composerScroll, composerStep, composerText, createComposer, type TuiComposerState } from './tui-composer.js';
|
||||
import { formatAwayDigest } from './tui-digest.js';
|
||||
@@ -1315,7 +1315,12 @@ class TuiApp {
|
||||
try {
|
||||
const raw = await this.client.fetchTerminalTail(sessionId, PREVIEW_TAIL_BYTES);
|
||||
if (this.previewSessionId !== sessionId) return;
|
||||
const lines = toDisplayLines(dropSeveredEscape(raw)).slice(-PREVIEW_MAX_LINES);
|
||||
const tail = toDisplayLines(dropSeveredEscape(raw)).slice(-PREVIEW_MAX_LINES);
|
||||
// A nerd font can draw anything; every other terminal gets the rare
|
||||
// prompt glyphs folded to the arrows they already look like, because a
|
||||
// font's per-glyph coverage cannot be detected from in here and tofu is
|
||||
// worse than an ASCII arrow.
|
||||
const lines = this.glyphTier === 'nerd' ? tail : tail.map(foldPreviewGlyphs);
|
||||
// An identical tail is what the backoff counts; anything new resets it, so
|
||||
// a pane that starts printing again is back to one read a second.
|
||||
if (this.applyPreview({ sessionId, lines })) this.previewQuiet = 0;
|
||||
|
||||
Reference in New Issue
Block a user