Skip to content

Align a table row that ends in a comment, and the rows after it - #38

Merged
david-Darkcollective merged 1 commit into
developfrom
fix/fmt-row-comments
Oct 9, 2026
Merged

david-Darkcollective merged 1 commit into
developfrom
fix/fmt-row-comments

Conversation

@david-Darkcollective

Copy link
Copy Markdown
Member

Fixes the two FmtTest failures on league.relix (keeps every comment, in order and --keywords parses to the same statements), which fail on develop with the current engine snapshot.

Needs DarkCollective/relix-core#106 in the snapshot first. Until it is published, CI here fails on those two cases and on the new test.

Cause

league.relix has comments at the end of two inline-table rows. The engine's printer moved them off their rows to after the table's ] (relix-core#106 fixes that). Once they stay on their rows, fmt's own column alignment was the next problem: it took a row to end in |, so a commented row ended the run being aligned, and every row after it was left unaligned:

| 16      | 6        | 1         | 25     |
| 17 | 6 | 2 | 58 |  -- keepers get on the scoresheet too
| 18 | 7 | 3 | 37 |

Change

ScriptFormatter.Tables aligns a row's cells without its -- comment, then writes the comment after them, two spaces from the last |. A comment is found as the parser finds it: after the row's last |.

Tests

  • New: FmtTest.Layout.rowComment checks that commented rows, and the rows after them, are aligned with each comment kept on its row.
  • Against a local build of relix-core#106 (published to ~/.m2), ./gradlew test passes, league.relix included.

The engine's printer now writes a comment after a Markdown row back on that
row (relix-core fix/table-row-comments). fmt's column alignment took a row
to end in |, so a commented row ended the run being aligned and every row
after it was left as the printer wrote it. A row's cells are now aligned
without its comment, which follows them after two spaces.
@david-Darkcollective
david-Darkcollective merged commit d2de901 into develop Oct 9, 2026
3 of 6 checks passed
@david-Darkcollective
david-Darkcollective deleted the fix/fmt-row-comments branch October 9, 2026 18:19
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.

1 participant