Public buffer getChars and translateToString truncate multi-codepoint graphemes
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript, wasm
Direzione di ricerca
Start with Buffer.getLine(), BufferCell.getChars(), and translateToString(), then compare their scalar-cell handling with the existing viewport and scrollback grapheme accessors. Reproduce the examples with Bun 1.4.2 and verify that exported buffer text preserves each complete grapheme while retaining existing line snapshot behavior and empty wide-character spacer cells.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
[email protected] public buffer getChars() and translateToString() truncate multi-codepoint graphemes. The real WASM core retains the complete text; this report is specifically about buffer export, not visible canvas rendering or parsing.
Minimal reproduction
After bun add [email protected], run with Bun 1.4.2:
import { Ghostty, Terminal } from 'ghostty-web'
const ghostty = await Ghostty.load()
for (const input of ['ASCII', 'é', '👩💻', '👋🏽', '🇺🇸']) {
const core = ghostty.createTerminal(24, 2)
const terminal = new Terminal({ ghostty, cols: 24, rows: 2 })
// Headless setup only: attach the real WASM core to the public buffer wrapper.
terminal.wasmTerm = core
core.write(input)
const line = terminal.buffer.active.getLine(0)
console.log({ input, buffer: line.translateToString(true),
firstCell: line.getCell(0).getChars(), core: core.getGraphemeString(0, 0) })
// Do not dispose these instances: teardown corruption is separately tracked in #141.
}
Expected: buffer export equals input. Actual: ASCII matches, but é becomes e, 👩💻 becomes 👩, 👋🏽 becomes 👋, and 🇺🇸 becomes 🇺. The low-level grapheme lookup returns complete text in every case. Reproduced on Linux x64.
Root cause / proposed fix
Buffer.getLine() only forwards scalar cells to BufferLine; BufferCell.getChars() uses String.fromCodePoint(cell.codepoint) without consulting grapheme_len or the existing viewport/scrollback grapheme accessors. translateToString() concatenates these truncated values.
Snapshot complete grapheme text alongside the scalar cells when creating a buffer line, using the appropriate viewport or scrollback lookup. This preserves existing line snapshot behavior and empty wide-character spacer cells.
Repeated open/closed issue and PR searches found no matching buffer-export report. Related but distinct: #141 tracks memory corruption when freeing terminals containing these graphemes; this is not a duplicate report for that teardown bug.
Posted on behalf of @schickling
| field | value |
|---|---|
agent_identity |
unknown |
session |
dev5.01a09047 |
agent_persona |
generalist |
agent_supervisor |
unavailable |
agent_tool |
OMP |
agent_tool_version |
18.4.4 |
agent_runtime |
OMP 18.4.4 |
agent_model |
anthropic/claude-opus-5-5 |
worktree |
dotfiles/main |
tooling_profile |
dotfiles@7a9494a |
- Lingua principale
- TypeScript
- Stelle
- 2.9k
- Fork
- 182
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di coder/ghostty-web
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
coder/ghostty-web#205 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
coder/ghostty-web#204 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
coder/ghostty-web#203 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
coder/ghostty-web#199 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
coder/ghostty-web#198 ·
Tutte le issue di coder/ghostty-web
Issue simili
-
A hung CI job runs for 6 hours before it is cancelledForse già presa @Olanetsoft l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Olanetsoft/agent-lookout#110 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
thedotmack/claude-mem#4757 ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 bug 🗺️ MCP OAuth
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
LibreChat-AI/LibreChat#17077 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100