Skip to content

fix(table): ignore extra cells when rendering rows - #1092

Merged
andrinoff merged 1 commit into
charmbracelet:mainfrom
janearc:fix/table-ignore-extra-cells
Nov 18, 2026
Merged

andrinoff merged 1 commit into
charmbracelet:mainfrom
janearc:fix/table-ignore-extra-cells

Conversation

@janearc

@janearc janearc commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Stop rendering at the configured column count so extra cells don't cause a panic. Keep the full row data intact.

Add positive, negative, and regression tests for normal rows, preserved data, extra cells, and rows without columns.

  • [👩🏻‍🎤] I have read CONTRIBUTING.md.
  • [🚳] I have created a discussion that was approved by a maintainer (for new features).

fix(table): ignore row cells beyond the configured columns

Rendering a row with more cells than columns indexes beyond the columns slice. Stop at the configured column count. Regressions exercise construction and updates through the row/column APIs.

The component tests fail on unpatched main and pass with this fix. The component test and vet checks pass on Go 1.27.4, macOS arm64.

Open #772 and #617 propose broader table replacements; #1003, #1054, #1064 and #1080 address cursor/viewport behavior. This guard only ignores cells beyond the configured columns while rendering, retaining the original row data.

Separate tests cover positive behavior (TestRenderRowConfiguredColumns), negative controls (TestRenderRowDoesNotDiscardExtraData), and the regression (TestModel_RenderRow_MoreCellsThanColumns). A representative regression fails on unchanged main and passes with the fix. The positive control passes on main; a deliberate break is also caught by the negative test.

Validation on owner main 1deada954e6e, Go 1.26.10:

  • Full native arm64 race suite passes (-count=1 -cpu=1,4), plus 20 focused race repetitions.
  • Full amd64 tests and race suite pass under Rosetta.
  • Exact CI-pinned golangci-lint v2.13.1, formatting, vet and module tidy pass. Module files are unchanged.
  • Linux/Windows 386 (i386), amd64 and arm64, plus Darwin amd64: build, all-package test compilation, vet and configured lint pass.
  • Aggregate root-module statement coverage: 55.9557% (1818/3249) → 55.9828% (1820/3251); it does not decrease.

Cross-target binaries were compiled rather than executed. These are local results; remote CI remains to be confirmed.

disclosure: i am working on my own harness, i use claude, i found a bunch of these while working on that code. i root caused them with claude, claude wrote the fix (this is very tiny, it'sbasically one line). i reviewed it, i asked codex to review it, and kimi looked cross at me acrossthe kitchen table.please lmkif you have questions, i'm tres responsive on github.

Stop rendering at the configured column count so extra cells don't
cause a panic. Keep the full row data intact.

Add positive, negative, and regression tests for normal rows,
preserved data, extra cells, and rows without columns.
@andrinoff
andrinoff merged commit 4c0b283 into charmbracelet:main Nov 18, 2026
11 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