fix(cli): refresh terminal width while editing and keep history-recall separators
メンテナーはふだん 10 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 20/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- zig
- 領域
- cli
調査の方向性
Read src/channels/cli.zig and src/channels/cli_line_editor.zig for terminal-width sampling and redraw behavior, then inspect src/agent/cli.zig for history recall and rememberReplInput. Add tests for resizing between refreshes and for multiline history round-tripping, and run zig build test --summary all. A linked open pull request (#1041) is already working on this issue.
索引モデルが issue の本文から書いたものです。
説明
Source
Non-blocking follow-ups from the approval on #970:
it would be good to refresh terminal width while editing (currently sampled once per prompt, so shrinking the terminal can invalidate the one-row viewport assumption), and to preserve a separator when recalling debounce-coalesced multiline history instead of simply removing its newline bytes. Native Windows console editing remains an explicitly documented follow-up.
#970 merged as f239fa1c, so both items are now unblocked and can be implemented directly against main.
Problem
- Terminal width is sampled once per prompt.
src/channels/cli.zig:168readsCliRawMode.terminalColumns(stdout.handle)once, then passes that value to everycli_line_editor.renderLineRefreshcall for the whole editing session. Shrink the terminal mid-edit and the editor keeps rendering for the old width, breaking the one-row viewport assumption (content_columns = usable_columns - prompt_widthinsrc/channels/cli_line_editor.zig:432). - Multiline history recall loses its separator. Debounce coalescing joins inbound lines; recalling that entry drops the newline bytes rather than preserving a separator, so the recalled text is not the text that was entered.
Smoke test on merged main (post-#970)
Driven through a real PTY against f239fa1c, since #970's approval noted that resize behavior was "inspected in code, not claimed as an OS-level smoke test."
Item 1 reproduced. A 60-character line was entered at 80 columns, the PTY was resized to 40 columns via TIOCSWINSZ + SIGWINCH, and a redraw was forced with a cursor key. The editor kept rendering a single row for the line, and after typing one more character the 61-character line was still rendered one-row in a 40-column window. The editor does not re-measure on resize, confirming the sampled-once behavior described above.
The rest of the editor checked out clean in the same run, which is useful negative evidence that the smoke harness is sound:
←/→cursor movement and insert-at-position: correctHome/End: correctBackspace: correctCtrl-Ccancel: line cleared correctly- History recall (
↑/↓): correct, including boundaries at a single history entry SIGTSTP/SIGCONT: input line preserved across suspend and resume
Proposed
- Re-read the terminal columns on each refresh (or on resize) instead of caching per prompt, keeping the ioctl cost off the hot path if it matters.
- Preserve a separator (the original newline, or an explicit substitute) when rebuilding a recalled multiline history entry.
Out of scope: native Windows console editing — tracked in #1037.
Test plan
- Editor tests: render at width A, shrink to width B, assert the next refresh uses B (no fixed-width assumption).
- History tests: a coalesced multiline entry recalls with its separator intact and round-trips through
rememberReplInput. zig build test --summary all(0 failures, 0 leaks),zig fmt --check src/,zig build -Doptimize=ReleaseSmall.
Still unverified
Item 2's multiline/debounce path was not exercised by the smoke test above: a PTY cannot deliver an embedded newline without submitting the line, so debounce coalescing could not be triggered from a keyboard. That path remains code-inspection only and should be covered by the unit tests above, or by a PTY harness that writes a coalesced buffer directly rather than simulating keystrokes.
Scope / risk
- Medium risk (
src/channels/cli_line_editor.zig,src/agent/cli.zig,src/channels/cli.zig) — interactive rendering path. - Code change, so tracked separately from the approved PR #970 (now merged).
- 主要言語
- Zig
- スター
- 8.1k
- フォーク
- 945
- 平均マージ
- 7日 6時間
- マージ済み PR(30日)
- 7
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nullclaw/nullclaw のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
nullclaw/nullclaw#1078 · コメント 2 件 ·
メンテナーはふだん 10 日以内に返信
-
ci: gate Docker image changes on PRs and before release publish対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 10 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
nullclaw/nullclaw#993 · コメント 1 件 ·
メンテナーはふだん 10 日以内に返信
-
難易度 4/5 1週間以上 初心者へのやさしさ 12/100
メンテナーはふだん 10 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
nullclaw/nullclaw#1055 · コメント 3 件 ·
メンテナーはふだん 10 日以内に返信
nullclaw/nullclaw の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
neondatabase/neon-pkgs#941 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
longbridge/gpui-kit#3675 ·
メンテナーはふだん 1 日以内に返信
-
[Request] Add BBportオープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
area:bash bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anthropics/claude-code#104799 ·
メンテナーはふだん 1 日以内に返信