Registry Mirror
Skip to content

Conversation

@teepark

@teepark teepark commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

feat(config): add auto_width_threshold and raise its default to 200

Problem

auto layout switches from unified to split at a hard-coded 120 terminal columns. That leaves each side of a split diff only about 60 columns, which is narrower than most code is written for. On common terminal widths, lines get truncated or need horizontal scrolling. There's no way to change the cutoff.

Approach

This PR has two commits that can be reviewed (and accepted) separately:

  1. feat(config): add auto_width_threshold for auto layout: adds a top-level auto_width_threshold setting (a positive integer, in terminal columns) that replaces the hard-coded cutoff. It defaults to 120, so this commit doesn't change any behavior. The setting goes through the existing config catalog, so validation, user/repo layering, and the generated config reference all work
    the same way as other settings.
  2. feat(config): raise default auto_width_threshold to 200: raises the default to 200 columns, so a split diff gives each side about 100 columns. Anyone who prefers the old behavior can set auto_width_threshold = 120.

If you'd like the setting but not the new default, the first commit stands on its own and has been validated independently. Just drop the second.

Sidebar visibility is unchanged. It still depends only on the existing 160/220-column viewport buckets.

Non-goals

  • No TUI control or quit-time save for the setting. The other integer settings (tab_width, file_gap, hunk_gap, wheel_scroll_lines) are config-only too. A View-menu item that sets the threshold to the current width would be a possible follow-up.
  • No CLI flag.

Why core

auto layout is resolved in core (resolveResponsiveLayout), and this makes one of its constants configurable. It doesn't add any new behavior that could live in an extension instead.

Tests

  • responsive.test.ts: the exact switch point at the default, plus lower and higher configured thresholds, and a check that explicit split/unified modes ignore the threshold.
  • AppHost.responsive.test.tsx: a configured threshold moves the split cutoff in the rendered app. For frames that show the sidebar, the split check now looks for old and new lines on the same row, because the sidebar's selection marker also draws ▌.
  • config.test.ts: the default value, a configured value, and rejection of 0, -1, 150.5, and a string.
  • test/pty/layout.test.ts (second commit): the live-resize test now expects unified view below 200 columns.

Validation

I ran all of these on each commit separately and on main (macOS, Bun 1.4.3):

  • bun run format:check, lint, typecheck, deps:check, check:docs
  • bun run test
  • bun run test:integration

On the second commit, one full test:integration run hit a flake in "explicit split mode stays split after a live resize". That test forces split mode, so the threshold can't affect it. It passed 5/5 runs on its own, and a full rerun passed 222/222.

bun run test:tty-smoke doesn't run here because it needs util-linux script, which macOS doesn't have. Instead I ran hunk show <first commit> --mode auto from source in a real TTY (tmux) with a clean config directory:

Commit Width Threshold Layout
first 150 / 120 / 119 default (120) split / split / unified
first 140 160 unified
first 110 100 split
second 210 / 199 / 150 default (200) split / unified / unified
second 140 120 split
second 240 300 unified

Platforms: tested on macOS only; not tested on Linux or Windows.

Visual evidence

Sizing decision made by the current hunk with mode = "auto":
SCR-20261012-kxdo

@greptile-apps

greptile-apps Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Oct 12, 2026

Copy link
Copy Markdown

@teepark is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@benvinegar

Copy link
Copy Markdown
Member

I generally agree the auto ranges are not good right now.

@benvinegar
benvinegar force-pushed the auto-width-threshold branch 2 times, most recently from ef2121b to 36d5196 Compare October 13, 2026 02:44
@benvinegar

Copy link
Copy Markdown
Member

Rebased onto current main and preserved the README simplification/state-directory documentation. The setting is now auto_split_min_width, defaults to 160, and measures available diff columns after side panes and outer padding. Auto layout re-evaluates when panes open, close, or resize; explicit layouts and terminal-width-based sidebar visibility remain unchanged. Added rendered-app and PTY coverage, including a right-side extension pane.

The first CI run passed Linux validation, PTY integration, website, Nix, and compiled portability. Windows only failed on an EBUSY temporary executable cleanup after the highlighter assertions; the follow-up commit adds bounded filesystem cleanup retries.

This comment was generated by Pi using GPT-6.1-sol

teepark and others added 4 commits October 12, 2026 23:03
Replace the hard-coded 120-column cutoff where auto mode switches from
unified to split with a configurable auto_width_threshold setting. The
default stays at 120, so behavior is unchanged unless configured.
A 120-column cutoff leaves only about 60 columns per side in split view,
which truncates most real code. Default to 200 so each side gets roughly
100 columns; auto_width_threshold = 120 restores the previous behavior.
@benvinegar
benvinegar force-pushed the auto-width-threshold branch from ddc73c0 to 1878110 Compare October 13, 2026 03:04
@benvinegar
benvinegar enabled auto-merge (squash) October 13, 2026 03:06
@benvinegar
benvinegar merged commit 8d93ef6 into modem-dev:main Oct 13, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants