Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Public buffer getChars and translateToString truncate multi-codepoint graphemes

オープン
#200 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@schickling-assistant がすでに取り組んでいます。

2026年10月1日 から。

  • #201 @schickling-assistant による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript, wasm
領域
frontend, web-dev

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
2.9k
フォーク
182
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

coder/ghostty-web のほかの issue

coder/ghostty-web の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。