Repository navigation
cli: export the terminal display-width measure as CliOutput.displayWidth - #8982
Merged
Merged
Conversation
The measure that #7572 introduced for CLI help alignment stayed internal (visualLength in CliOutput.ts), so anything drawing next to the built-in output has to copy the grapheme and East Asian Width logic to line up with it, and the copy can drift. Export it unchanged as CliOutput.displayWidth with a doc comment. The function keeps stripping ANSI styling first, so styled and unstyled text measure alike. Refs #8863
🦋 Changeset detectedLatest commit: 92cf9b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
This was referenced Oct 15, 2026
brandhaug
added a commit
to brandhaug/b2b-saas-starter
that referenced
this pull request
Oct 15, 2026
## pnpm-workspace.yaml (default) ## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `@inlang/plugin-message-format` | 4.5.0 | 4.5.2 | patch | | `@tanstack/react-query` | 5.104.1 | 5.104.2 | patch | | `effect` | 4.0.2 | 4.0.3 | patch | ## Release Notes <details> <summary><b>@<!---->tanstack/react-query</b> (5.104.1 → 5.104.2)</summary> ### Patch Changes - Updated dependencies [[`03e8c39`](TanStack/query@03e8c39)]: - @<!---->tanstack/[email protected] </details> <details> <summary><b>effect</b> (4.0.2 → 4.0.3)</summary> ### Patch Changes - [#8977](Effect-TS/effect#8977) [`b4e5af8`](Effect-TS/effect@b4e5af8) Thanks @<!---->kitlangton! - Prevent crashes and premature interruption when `Effect.cached`, `Effect.cachedWithTTL`, and `Effect.cachedInvalidateWithTTL` are synchronously re-entered. - [#8982](Effect-TS/effect#8982) [`b8d6e7a`](Effect-TS/effect@b8d6e7a) Thanks @<!---->Yi-111-a! - Export `CliOutput.displayWidth` to measure terminal-cell widths using the same logic as built-in CLI help and tables. - [#8933](Effect-TS/effect#8933) [`89d5c88`](Effect-TS/effect@89d5c88) Thanks @<!---->tim-smart! - Respect `NO_COLOR` in CLI prompts and the command wizard, suppressing color and style escapes while preserving cursor and redraw controls. - [#8941](Effect-TS/effect#8941) [`66257d2`](Effect-TS/effect@66257d2) Thanks @<!---->Tanner-Scadden! - Hand cluster shards off one at a time when `Sharding` shuts down, after their entities and singletons have stopped, so live runners can take them over sooner. The handoff is best effort: its wait is bounded, and if it times out, `releaseAll` attempts to release the remaining locks. A runner that is shutting down no longer acquires new shards, and releasing a shard no longer waits forever on an entity whose id is also active on another shard. - [#8940](Effect-TS/effect#8940) [`cd2ab19`](Effect-TS/effect@cd2ab19) Thanks @<!---->Tanner-Scadden! - Fix cluster shard handoffs. Interrupts and stream acknowledgements now reach requests still draining on the previous owner, and `RpcServer` accepts acknowledgements for active streams after a client's EOF. Volatile requests sent duri …[full notes](https://github.com/Effect-TS/effect/releases/tag/effect%404.0.3) </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8863.
Closes EFF-1925.
What
visualLengthinCliOutput.ts— the measure #7572 introduced so CLI help aligns on terminal cells instead of UTF-16 code units — was never exported. Anything drawing next to the built-in output (a customCliOutput.Formatter, a banner, a table, a prompt built onPrompt.Custom) has to measure by the same rules to line up with it, and today the only options are copying that grapheme/East Asian Width logic into the application or depending onstring-width. Either way the application's measure can disagree with the one the built-in help uses, so the two drift.This exports the existing function unchanged as
CliOutput.displayWidth:No new logic.
padandrenderTablenow call the exported name, so it is the same function the built-in help renders with by construction. The issue also floated "a home ineffect/Stringinstead ofeffect/cli" as acceptable; I kept it ineffect/clisince that is where the built-in output lives and where the callers are, but happy to move it if you'd prefer.Notes
@stability unstable/@category measuring, matching the rest of the module. Current version is4.0.2, so the changeset is a patch;@sinceis set to4.0.3— correct me if the next release lands elsewhere.@internaldoc comment ongraphemeSegmenter(it described the width measure, not the segmenter).Tests
One focused
CliOutput.displayWidthtest in the existingpackages/effect/test/cli/Help.test.tscovers empty/ASCII input, wide characters, combining marks, emoji presentation and ANSI styling. Existing help tests already cover wide-grapheme and zero-width flag-name alignment; the redundant one-off test file has been removed.Validated during takeover:
nix develop -c pnpm lint-fix— clean.nix develop -c pnpm test --run packages/effect/test/cli/Help.test.ts— 27 tests passed.nix develop -c pnpm check— passed.This takeover pass changes tests and the PR description only; implementation review and comment/changeset cleanup remain for subsequent passes.