Skip to content

tui: improve table rendering with column alignment and expand toggle - #80

Draft
ompugao wants to merge 2 commits into
masterfrom
hotfix/better_table_rendering
Draft

tui: improve table rendering with column alignment and expand toggle#80
ompugao wants to merge 2 commits into
masterfrom
hotfix/better_table_rendering

Conversation

@ompugao

@ompugao ompugao commented Mar 24, 2026

Copy link
Copy Markdown
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
ompugao force-pushed the hotfix/better_table_rendering branch from baeb5cb to dde0be6 Compare April 15, 2026 04:35
ompugao and others added 2 commits April 15, 2026 14:43
- 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
ompugao force-pushed the hotfix/better_table_rendering branch from dde0be6 to 18316b7 Compare April 15, 2026 05:43
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