Skip to content

Streamline shell integration docs - #14

Closed
max-sixty wants to merge 1 commit into
mainfrom
codex/locate-outdated-docstrings-qcyjl6
Closed

max-sixty wants to merge 1 commit into
mainfrom
codex/locate-outdated-docstrings-qcyjl6

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

  • simplify the shell configuration long help while keeping manual setup steps and current shell support
  • condense worktree module documentation to a shorter dual-mode overview and exit code notes

Testing

  • not run (documentation changes only)

Codex Task

@max-sixty max-sixty closed this Nov 20, 2025
@max-sixty
max-sixty deleted the codex/locate-outdated-docstrings-qcyjl6 branch November 21, 2025 02:33
max-sixty added a commit that referenced this pull request Nov 28, 2026
…er UAX #14

Code is content a reader copies or checks, so it no longer hard-wraps
anywhere: help examples of every language, format_bash_with_gutter
(approval previews, shell snippets) and format_toml print each line
whole with its tabs. A pager or terminal that wraps a long line starts
the rest at column 0, outside the gutter. Synoptic expanded tabs in the
tokens it returns; its tokens are now read back from the source. The
`↪` continuation stays for quoted text that isn't code (format_with_gutter:
git output, file lists, error bodies), where a tab counts to the next
8-column stop and stays a tab. The picker's forge panes can't wrap a
line themselves, so code there still wraps behind `↪`.

Wrapping takes break opportunities from Unicode line breaking
(unicode-linebreak, as textwrap does), so text without spaces, such as
Japanese, fits a narrow pane. As in textwrap, a hyphen breaks only
between two letters or digits; a word that starts with a hyphen (a flag)
and a URL don't break, and inside a styled span such as inline code only
whitespace breaks. Text is prepared once and laid out at many widths. A
hyperlink open at a break is closed at the line's end and reopened on
the next; spans_from_ansi reads SGR with anstream and keeps OSC 8
boundaries as zero-width segments, so a trailing closer is no longer
dropped.

Tables: one search picks the widths, the fewest lines in the table with
each broken word counted as three lines, then the fewest breaks inside a
code span, then the fewest wrapped cell lines. Only a word wider than an
even share of the width may break, never leaving a tail under three
characters, after punctuation when the tail then fits. Each column is
laid out at most once per width, and only within the budget, so a 2 KB
cell no longer stalls `wt config state get` or a forge pane.

Help: the help path parses once with the plain tree, and builds the
marked tree only for a help request, in the existing template walk, so
`wt --version` does no help work. It now wraps clap's `{name} - {about}`
title and the usage line, which clap prints whole at any width, and
trims the space clap leaves where it breaks a line before inline code.

Forge text keeps every source line: CRLF separators, runs of blank
lines and blank lines at the end of a fence; a blank line before a block
quote stays outside it. HTML comments are removed one by one, keeping
the content around them. JSON keys stay dim when their colon is on the
next line. Chopped code lines use truncate_visible, and the list
footer's hanging indent uses the shared wrapper.
max-sixty added a commit that referenced this pull request Nov 29, 2026
…e ANSI with a VT parser

Every styled segment now says where it may break (BreakPolicy), set by
whoever knows: the Markdown parser's inline-code event makes Code, the
highlighter's own comment tokens make Comment, the rest of a code line
is Verbatim, and prose is Text. Text and comments break at whitespace
and, per UAX #14, between ideographs; inline code only at whitespace; a
line of code never. A hyphen, slash, underscore or dot no longer offers
a break: a word too wide for its column (table cells only) is split by
force, preferring a cut at a space or after punctuation that fills half
the room, never leaving a line that starts or ends with a space. A word
too wide for any line starts on the line it reaches, and counts once
however many cuts it takes. Break opportunities are classified in one
pass and layout advances by stored offsets; a test counts the work on
4 KB inputs.

Help examples reflow by policy (LineFit::Reflow): code stays whole; a
comment's text wraps onto lines that repeat its marker at its column
(or at the line's indent when the column leaves under a third of the
width), so the result still pastes; command output and fences with no
language or `text` wrap behind `↪`; `$ ` lines and JSON stay whole.
Approval previews and config files keep every line whole as before.

ANSI input is read in one pass by anstyle-parse (already in the
lockfile through anstream), mapping every SGR
parameter (selective resets, colon forms, 256-color and RGB) and OSC 8
with BEL or ST terminators; the anstream adapter and the separate OSC 8
scan are gone. Prefix widths and hanging indents count a tab to its
stop wherever the wrapper measures them.

Tables keep every column at least as wide as its widest word whenever
those widths fit together, so a code name such as
`{{ base_worktree_path }}` or `~/.config/worktrunk/config.toml` is not
split to save lines of prose; below that, only a word wider than an
even share may break. The fitter's comment states that it is a local
search and what it can miss.

The tree-sitter bash configuration is built once per process. Hook type
stubs join the command tree before the help layout walk, so `wt hook
pre-merge -h` gets the composed title and wrapping. Forge HTML comes
from pulldown-cmark's HTML events; comments are cut by a tag-aware scan,
so `<!--` inside a quoted attribute is data, and every other character
prints, blank lines included; a line that held only a comment goes with
it, and blank runs on both sides of it add up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant