Add :break-on-max-column-alignment-width? option - #426
Open
sirmspencer wants to merge 2 commits into
Open
Conversation
Add a new :max-column-alignment-width option for column alignment. Keys whose end column is at or within N participate in alignment; keys that end past column N receive a single space and are not padded.
sirmspencer
force-pushed
the
ms-break-line-on-max-width
branch
from
August 7, 2026 20:06
9a93bf0 to
71ff856
Compare
sirmspencer
force-pushed
the
ms-break-line-on-max-width
branch
from
August 8, 2026 21:52
71ff856 to
b693729
Compare
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.
Stacked on #425 — this PR's diff currently includes those changes too, and will narrow to just the new changes once #425 merges.
I will rebase when #425 is merged.
LLM notice
I have reviewed all of what is being submitted. The PR description was partially generated with LLM to show the current and expected behavior. Tests were generated with LLM help for completeness.
Problem
#425 added
:max-column-alignment-width, which excludes keys past a given column from participating in alignment. When the excluded key is a lot longer than the aligned ones, that single space still leaves the value sitting immediately against a column it didn't participate in. This can lead to very long lines depending on the value of :max-column-alignment-width.Current behavior
Config:
{:align-map-columns? true, :max-column-alignment-width 4}Input:
{:a 1 :bb 2 :ccccccc 3}Output —
:cccccccexceeds the width, falls back to a single space, and3still sits flush against the aligned column set by:a/:bb:{:a 1 :bb 2 :ccccccc 3}Solution
This PR does not change the behavior of
:max-column-alignment-width. Instead it adds a new flag,:break-on-max-column-alignment-width?, which only takes effect when:max-column-alignment-widthis also set.When the flag is true, a value whose key exceeds the width limit is moved onto its own line, indented under the keys, instead of falling back to a single space on the same line.
New behavior
Config:
{:align-map-columns? true, :max-column-alignment-width 4, :break-on-max-column-alignment-width? true}Input:
{:a 1 :bb 2 :ccccccc 3}Output —
:cccccccstill exceeds the width, but its value now moves to its own line instead of sitting against the column:{:a 1 :bb 2 :ccccccc 3}The same behavior applies to forms with
:align-form-columns?.Changes
:break-on-max-column-alignment-width?added todefault-options(falseby default)column-start-positionnow returns{:position ... :threshold ...}instead of a bare int, sopad-to-positioncan tell whether a given row's key exceeded the alignment-width thresholdpad-to-positiongains a branch: when the flag is set and the key exceeds the threshold, the value is moved onto its own line (newbreak-to-own-linehelper) instead of collapsing to a single space:max-column-alignment-widthtest-break-on-max-column-alignment-widthdeftest covers form alignment, map alignment, no-op without:max-column-alignment-width, and idempotency when a value is already on its own line