zjncs opened a new pull request, #5624:
URL: https://github.com/apache/rocketmq-dashboard/pull/5624

   Closes #5623
   
   ## Problem
   
   All three table renderers (`Rows`, `ConfigTable`, `ToolCallSummary`) padded 
columns by **rune count** via `text/tabwriter`, but terminals render East Asian 
Wide/Fullwidth runes (CJK ideographs, kana, fullwidth forms) as **two cells** — 
so every column after a CJK cell shifted:
   
   ```
   NAME    QUEUES
   订单主题    8        <- 4 runes = 8 display cells; tabwriter counted 4
   orders  8
   ```
   
   Topic and consumer-group names in Chinese deployments are very commonly CJK, 
so `topic list`, `group list` and the other table commands produced visually 
broken columns.
   
   ## Fix
   
   Replace tabwriter with a shared `writeTable` helper that pads columns to 
terminal **display width**, counting East Asian Wide and Fullwidth runes as two 
cells via `golang.org/x/text/width` (already in the module graph as an indirect 
dependency — promoted to direct; no new dependency added). The last column 
stays unpadded, matching tabwriter's trailing behavior; ASCII-only tables 
render byte-identically.
   
   ## Verification
   
   - New `TestRowsAlignsColumnsForWideRunes`: a two-row table (CJK name vs 
ASCII name) asserting the value column starts at the same display column on 
every line — **FAILS on master** (`QUEUES column starts at display column 12 
for the CJK row but 8 for the ASCII row`), **PASSES with this change**
   - Mutation check: stashing only the renderer change makes the test fail 
again; restoring it passes (`-count=1`)
   - Regression: the full rmqctl suite green (`ok` for cmd, internal/catalog, 
internal/catalog/generate, internal/config, internal/output, internal/studio); 
`go vet` and `gofmt` clean
   
   ## Collision note
   
   No open PR touches `internal/output/output.go` (our own 
#5602/#5604/#5614/#5618 are in `rmqctl/scripts/` and 
`internal/catalog/generate/`).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to