buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned text
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- api
調査の方向性
lib/buffer.ts から始めてください。ここでは codepoint === 0 のセルに対して getChars() が空文字列を返しています。そのうえに構築されている translateToString の実装も確認してください。空のセルにスペースを代入する処理がすでにある TerminalCore.getSelection() を参考にしてください。issue の再現手順で translateToString(true) が "a b" を返し、末尾の空白の削除も引き続き機能していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
IBufferLine.translateToString() (and IBufferCell.getChars()) return '' for empty cells (codepoint === 0), so text that an application positioned with cursor movement collapses: every blank run is removed and the remaining characters are glued together. xterm.js returns a space for an empty cell (translateToString(trimRight) keeps the layout). TerminalCore.getSelection() already does the right thing (k += " " for codepoint === 0), so the two disagree on the same screen.
This is separate from #200 (multi-codepoint graphemes truncated); the blank-cell case affects plain ASCII. Seen on [email protected]; lib/buffer.ts on main has the same codepoint === 0 ? '' in getChars().
Minimal reproduction
<div id="t"></div>
<script type="module">
import { init, Terminal } from 'ghostty-web';
await init();
const term = new Terminal({ cols: 40, rows: 5 });
term.open(document.getElementById('t'));
// "a", move right 5 columns (CUF), "b": what vim/htop/tmux status bars do all the time
term.write('a\x1b[5Cb', () => {
const line = term.buffer.active.getLine(0);
console.log(JSON.stringify(line.translateToString(true))); // actual: "ab" expected: "a b"
term.select(0, 0, 7);
console.log(JSON.stringify(term.getSelection())); // "a b" (selection is correct)
});
</script>
Anything built on the public buffer API (search, serialize, accessibility mirrors, "copy line", tests) sees the collapsed text.
Suggested fix
getChars() returns ' ' for codepoint === 0 (width 1), or translateToString substitutes ' ' for empty cells before trimEnd().
Found while comparing renderers for https://github.com/erisera-code/clawser.
- 主要言語
- TypeScript
- スター
- 2.9k
- フォーク
- 182
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/ghostty-web のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
coder/ghostty-web#204 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
coder/ghostty-web#203 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemes対応中かも @schickling-assistant が 9 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
coder/ghostty-web#200 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
coder/ghostty-web#198 ·
coder/ghostty-web の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JoviDeCroock/pracht#432 ·
メンテナーはふだん 1 日以内に返信
-
approved check:passed streams:add
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Hardware attribute name "app Connection Support" has inconsistent casing対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
walletbeat/walletbeat#1628 ·
メンテナーはふだん 1 日以内に返信
-
bug go
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
genkit-ai/genkit#6761 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NousResearch/hermes-agent#136483 ·
メンテナーはふだん 1 日以内に返信