Skip to content

Added Append method for tables#163

Merged
djthorpe merged 1 commit into
mainfrom
djt/0713/tui
Jul 14, 2026
Merged

Added Append method for tables#163
djthorpe merged 1 commit into
mainfrom
djt/0713/tui

Conversation

@djthorpe

Copy link
Copy Markdown
Member

This pull request enhances the table component in the TUI package to support buffered row management, allowing rows to be appended and automatically flushed on write. It also introduces new tests to ensure the correct behavior of row buffering and flushing.

Enhancements to table row management:

  • Added a rows field to the table struct to buffer appended rows before rendering.
  • Implemented an Append method on table to add rows to the buffer.
  • Modified the Write method to use buffered rows, flush them after writing, and support writing without passing rows explicitly.

Testing improvements:

  • Updated existing tests to use the new Append method and verify newline handling.
  • Added a new test TestTableWriteFlushesBufferedRows to confirm that buffered rows are correctly flushed after writing.

Copilot AI review requested due to automatic review settings July 14, 2026 06:04
@djthorpe djthorpe self-assigned this Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the TUI table helper to support buffering rows on the table instance (via Append) and rendering them later (via Write), instead of requiring all rows to be passed directly to Write.

Changes:

  • Added an internal rows []T buffer plus a new Append(rows ...T) method on table.
  • Updated Write to render from buffered rows (and to accept optional rows to append before rendering), then flush the buffer after writing.
  • Extended tests to validate newline behavior and that buffered rows are flushed after a write.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/tui/table.go Adds buffered row storage with Append, updates Write to render/flush buffered rows.
pkg/tui/table_test.go Updates tests to use Append and adds a flush regression test for buffered rows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/tui/table.go
Comment thread pkg/tui/table_test.go
@djthorpe
djthorpe merged commit e8a2ada into main Jul 14, 2026
1 check passed
@djthorpe
djthorpe deleted the djt/0713/tui branch July 14, 2026 06:07
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