tui: improve table rendering with column alignment and expand toggle - #80
Draft
ompugao wants to merge 2 commits into
Draft
tui: improve table rendering with column alignment and expand toggle#80ompugao wants to merge 2 commits into
ompugao wants to merge 2 commits into
Conversation
ompugao
commented
Mar 24, 2026
Owner
- Two-pass rendering: measure all cells first, then render with padding so every column separator │ lands at the same display column
- Compact mode (default): cells are truncated with … when they exceed MAX_COL_WIDTH = (viewport_width/2).clamp(20,80); trailing │ is always aligned
- Expanded mode (toggle with 't'): no truncation, no trailing │; full cell content visible, only inter-column separators aligned
- Header row (first row) rendered in bold
- Dynamic MAX_COL_WIDTH adapts to terminal width passed from App
- Add truncate_cell_spans() helper for unicode-aware clipping
- Add compute_column_widths() taking explicit max_col_w argument
- CJK double-width characters handled correctly via unicode-width
- Three regression tests: ASCII alignment, CJK alignment, truncation
ompugao
force-pushed
the
hotfix/better_table_rendering
branch
from
April 15, 2026 04:35
baeb5cb to
dde0be6
Compare
- Two-pass rendering: measure all cells first, then render with padding so every column separator │ lands at the same display column - Compact mode (default): cells are truncated with … when they exceed MAX_COL_WIDTH = (viewport_width/2).clamp(20,80); trailing │ is always aligned - Expanded mode (toggle with 't'): no truncation, no trailing │; full cell content visible, only inter-column separators aligned - Header row (first row) rendered in bold - Dynamic MAX_COL_WIDTH adapts to terminal width passed from App - Add truncate_cell_spans() helper for unicode-aware clipping - Add compute_column_widths() taking explicit max_col_w argument - CJK double-width characters handled correctly via unicode-width - Three regression tests: ASCII alignment, CJK alignment, truncation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ompugao
force-pushed
the
hotfix/better_table_rendering
branch
from
April 15, 2026 05:43
dde0be6 to
18316b7
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.