Skip to content

fix(statusline): treat COLUMNS=0 as no width, not a zero budget - #3318

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-28357689944
Jun 29, 2026
Merged

max-sixty merged 1 commit into
mainfrom
nightly/clean-28357689944

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Problem

terminal_dimensions() parsed the COLUMNS env var into a width unconditionally:

let columns = std::env::var("COLUMNS").ok()?.parse::<usize>().ok()?;
Some((columns, None))

So COLUMNS=0 returned Some((0, None)). terminal_width_for_statusline() then subtracts a fixed UI margin and run_statusline subtracts one more for the leading space, collapsing the content budget to zero — fit_to_width drops every segment and the statusline renders empty. The docstring promises the opposite: "Returns None when no width is detectable … in which case the statusline renders everything untruncated."

This is a follow-up to #3286, which introduced the COLUMNS-based statusline sizing (replacing the parent-TTY walk).

Fix

Treat a zero COLUMNS as no width at all (None), so an absurd value falls through to the untruncated render exactly like a missing COLUMNS:

let columns = std::env::var("COLUMNS")
    .ok()?
    .parse::<usize>()
    .ok()
    .filter(|c| *c > 0)?;

Test

Added test_statusline_zero_columns_renders_untruncated: a COLUMNS=0 render must be non-empty and identical to a wide-terminal (COLUMNS=500) render, since both should be untruncated. The test fails against the pre-fix code (panics on "must not collapse the statusline to empty") and passes with the fix.

Found during the nightly code-quality sweep. Low severity in practice — Claude Code (the only caller that sets COLUMNS for the statusline) won't pass 0 — but the empty-render contradicts the documented behavior, so the guard is cheap insurance against any caller that does.

`terminal_dimensions()` parsed `COLUMNS` into the width unconditionally,
so `COLUMNS=0` returned `Some((0, None))`. The statusline then subtracted
its UI margin, collapsed the content budget to zero, and dropped every
segment — rendering an empty line instead of falling through to the
untruncated render the docstring promises for "no detectable width".

Treat a zero `COLUMNS` as absent (return `None`), so absurd values render
untruncated like a missing `COLUMNS`. Follow-up to #3286, which introduced
the `COLUMNS`-based statusline sizing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Jun 29, 2026
@max-sixty
max-sixty enabled auto-merge (squash) June 29, 2026 08:28
@max-sixty
max-sixty merged commit 1d2b834 into main Jun 29, 2026
32 of 42 checks passed
@max-sixty
max-sixty deleted the nightly/clean-28357689944 branch June 29, 2026 08:58
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
worktrunk 0.64.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## Release Notes

### Improved

- **`{{ git.branch.* }}` template namespace for custom columns**: `wt list` custom columns can now read a branch's own git config via `{{ git.branch.<key> }}` — both convention keys you set yourself (`branch.<name>.jira`) and the git-native `branch.<name>.description` — without re-storing the values through `wt config state vars set`. It complements `{{ vars.* }}`, which reads only worktrunk's own state namespace. ([#3319](max-sixty/worktrunk#3319), thanks @cazador481 for the request)

- **Faster warm-cache `wt list` re-runs**: A repeat `wt list` (with `.git/wt/cache/` already populated) is ~36% faster, by removing redundant per-row git subprocesses — priming the commit→tree cache from the `%ct` batch already issued, persisting merge-base results to a content-addressed on-disk cache, and seeding worktree roots and git-dirs from the single `git worktree list` instead of re-forking `git rev-parse` per worktree. ([#3334](max-sixty/worktrunk#3334))

### Fixed

- **Refs that look like flags can't inject git options**: `wt`'s `git diff` previews and diffstats (picker diff previews, `show_diffstat`, push diffstat) now fence user-controlled refs behind `--end-of-options`, and branch removal (`git branch -D`) passes them after `--`, so a branch literally named like a flag (`-x`, `--foo`) reaches git as a positional ref instead of being misparsed as an option. ([#3317](max-sixty/worktrunk#3317))

- **Statusline renders untruncated when `COLUMNS=0`**: `wt list statusline` treated `COLUMNS=0` as a zero-width budget and dropped every segment, rendering an empty line. A zero or unparsable `COLUMNS` is now treated as no detectable width, so the line renders everything untruncated — as the statusline sizing already documented for a missing width. ([#3318](max-sixty/worktrunk#3318))

- **Watchdog "still waiting" line uses the hint symbol**: The transient `Waiting for the commit message (Ns)` line shown during a slow `wt step commit` LLM call now uses the hint prefix (`↳`) instead of the info symbol (`○`), matching the convention for fully-dim status lines. ([#3330](max-sixty/worktrunk#3330))

## Install worktrunk 0.64.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-installer.sh | sh && wt config shell install
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-installer.ps1 | iex"; git-wt config shell install
```

### Install prebuilt binaries via Homebrew

```sh
brew install worktrunk && wt config shell install
```

## Download worktrunk 0.64.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-x86_64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-pc-windows-msvc.zip](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-x86_64-pc-windows-msvc.zip.sha256) |
| [worktrunk-aarch64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-aarch64-unknown-linux-musl.tar.xz.sha256) |
| [worktrunk-x86_64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.64.0/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256) |



### Install via Cargo

```sh
cargo install worktrunk && wt config shell install
```

### Install via Winget (Windows)

```sh
winget install max-sixty.worktrunk && git-wt config shell install
```

### Install via AUR (Arch Linux)

```sh
paru worktrunk-bin && wt config shell install
```
</pre>
  <p>View the full release notes at <a href="https://github.com/max-sixty/worktrunk/releases/tag/v0.64.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.64.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!13223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants