Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Public buffer getChars and translateToString truncate multi-codepoint graphemes

Aperta
#200 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@schickling-assistant ci sta già lavorando.

Dal 1/10/2026.

  • #201 di @schickling-assistant — aperta

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
Ambito
frontend, web-dev

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di coder/ghostty-web

Tutte le issue di coder/ghostty-web

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.