Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- frontend
調査の方向性
lib/input-handler.ts から始めてください。ここでは isPrintableCharacter が Alt 修飾のキーを除外し、handleKeyDown がそれらをキーエンコーダーに渡しています。KeyEncoderOption.ALT_ESC_PREFIX が実際に設定されることがあるかを確認してください。完了の条件は、ディスパッチされた Alt+b が文字列 "\u001bb" を生成すること、Alt+ArrowLeft と Alt+Backspace が従来どおりエンコードされ続けること、そして #109 で言及されている macOS のパスを壊さずに Linux で変更が動作することです。
索引モデルが issue の本文から書いたものです。
説明
Summary
Alt+<printable key> sends the bare key with no ESC prefix. Terminal applications rely on the meta prefix (readline Alt-b/Alt-f/Alt-d, emacs M-x, tmux/vim meta mappings), so all of them silently lose their Alt bindings. This is the Linux/Windows case of what #109 describes for macOS: isPrintableCharacter() correctly refuses Alt-modified keys, but they then reach the Ghostty key encoder without KeyEncoderOption.ALT_ESC_PREFIX ever being set, so the encoder emits just the character.
Seen on [email protected] (Chromium 14x on Linux). The same code path is unchanged on main (lib/input-handler.ts: isPrintableCharacter returns false for Alt, nothing sets ALT_ESC_PREFIX). (Shift+Tab from #109 is fixed on main but not in the published 0.4.0 -- see #137.)
Minimal reproduction
<div id="t"></div>
<script type="module">
import { init, Terminal } from 'ghostty-web';
await init();
const term = new Terminal();
term.open(document.getElementById('t'));
term.onData((d) => console.log(JSON.stringify(d)));
term.focus();
// Press Alt+B, or dispatch it:
term.element.dispatchEvent(new KeyboardEvent('keydown', { key: 'b', code: 'KeyB', altKey: true, bubbles: true, cancelable: true }));
</script>
Actual: "b". Expected (xterm.js, every native terminal, Ghostty itself with macos-option-as-alt/Linux defaults): "\u001bb".
Alt+ArrowLeft ("\u001b[1;3D") and Alt+Backspace ("\u001b\u007f") are fine, so the encoder path itself works; only the printable-key case loses the prefix.
Suggested fix
Either set KeyEncoderOption.ALT_ESC_PREFIX on the encoder (it is already a defined option) and let Alt+printable go through it, or handle altKey && !ctrlKey && !metaKey && event.key.length === 1 in handleKeyDown by emitting '\x1b' + event.key (on macOS, derive the letter from event.code as proposed in #109, since event.key is the composed character there).
Found while evaluating ghostty-web as a PTY renderer for https://github.com/erisera-code/clawser; the host currently works around it with attachCustomKeyEventHandler.
- 主要言語
- TypeScript
- スター
- 2.9k
- フォーク
- 182
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/ghostty-web のほかの issue
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
coder/ghostty-web#205 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
coder/ghostty-web#204 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemes対応中かも @schickling-assistant が 10 日前に担当しました。 オープン
難易度 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
-
by: ai-assisted frontend good-for: new-member spike
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Northeastern-Electric-Racing/Argos#847 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
SignalK/freeboard-sk#990 ·
メンテナーはふだん 1 日以内に返信
-
[missing-inheritance] audit review (1 preset)対応中かも @github-actions が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
osmberlin/tagging-schema-browser#363 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Albert-Weasker/niubigeo#205 ·
メンテナーはふだん 1 日以内に返信
-
area/frontend area/v2 kind/bug priority/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
kubeflow/notebooks#1498 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信