Skip to content

fix: table handles full-width characters @W-22163225@#289

Merged
soridalac merged 3 commits intomainfrom
jf/W-22163225
Apr 28, 2026
Merged

fix: table handles full-width characters @W-22163225@#289
soridalac merged 3 commits intomainfrom
jf/W-22163225

Conversation

@jfeingold35
Copy link
Copy Markdown
Contributor

@jfeingold35 jfeingold35 commented Apr 27, 2026

Resolves a bug wherein strings that use full-width characters (e.g., 'ABC' or 'ワイド') would print with table margins misaligned.

The cause of the bug was that all margins and spacing were being determined with String.length, which treats all of those full-width characters as being one character long instead of two. This explains why the issue didn't occur for emoji, since emoji count as length-2 instead of length-1.

The fix was to pull string-width, which was previously a nested dependency via other libraries, into a top-level dependency and use it in the places where we'd previously been using String.length. string-width returns a string's visual width rather than its strict character length, so the table is now rendered properly.

GH issue related: forcedotcom/cli#3538
@W-22163225@

@git2gus
Copy link
Copy Markdown

git2gus Bot commented Apr 27, 2026

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

Comment on lines +1 to +11
┌──────────────────┬─────────────────────────────────────────┐
│ C1 │ C2 │
├──────────────────┼─────────────────────────────────────────┤
│ first row value │ a string with only normal chars │
├──────────────────┼─────────────────────────────────────────┤
│ second row value │ a string with Japanese chars: ワイド │
├──────────────────┼─────────────────────────────────────────┤
│ third row value │ a string with emoji: 🍁🍁 │
├──────────────────┼─────────────────────────────────────────┤
│ fourth row value │ a string with full-width latin: ABC. │
└──────────────────┴─────────────────────────────────────────┘
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For whatever reason, all of the examples render slightly improperly in the Github UI (as well as in my IDE, which was confusing for some time), but I can assure you that if you do cat test/__snapshots__/examples-120/full-width.txt, the table will display properly.

Image

@soridalac
Copy link
Copy Markdown
Contributor

QA notes:
using command: sf alias set
✅ : table display output align correctly and fix full-width characters
Screenshot 2026-04-28 at 10 31 40 AM

@soridalac soridalac merged commit 226eaf4 into main Apr 28, 2026
13 checks passed
@soridalac soridalac deleted the jf/W-22163225 branch April 28, 2026 17:37
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