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

fix(cli): refresh terminal width while editing and keep history-recall separators

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

メンテナーはふだん 10 日以内に返信

@vernonstinebaker がすでに取り組んでいます。

2026年10月5日 から。

  • #1041 @vernonstinebaker による — オープン

評価

難易度
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

  1. Terminal width is sampled once per prompt. src/channels/cli.zig:168 reads CliRawMode.terminalColumns(stdout.handle) once, then passes that value to every cli_line_editor.renderLineRefresh call 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_width in src/channels/cli_line_editor.zig:432).
  2. 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: correct
  • Home / End: correct
  • Backspace: correct
  • Ctrl-C cancel: 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

nullclaw/nullclaw のほかの issue

nullclaw/nullclaw の issue をすべて見る

似ている issue

CLI の issue をもっと見る

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

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