Emojis in tables messes up the column alignment
See original GitHub issueMy assumption is this is due to emojis taking up two unicode codepoints but getting rendered using only spot. As a result, the columns are off.
Reproduction:
from rich.console import Console
from rich.table import Table
console = Console()
table = Table(title="Emoji Table")
table.add_column("emoji", justify="left", no_wrap=True)
table.add_row(":smiley:")
table.add_row(":no_entry:")
table.add_row(":white_heavy_check_mark:")
console.print(table)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Emoji break the column alignment · Issue #44 - GitHub
Emoji break the column alignment in edit mode. In preview the tables look perfect. To Reproduce Insert an emoji in any column Hit...
Read more >Tables not aligned in Orgmode column-view : r/emacs - Reddit
Valign is excellent, but my problem is with emojis, and those screw up tables in column view.
Read more >How can I align emoji with text in table cell? - Stack Overflow
The emoji is first and puts the text(numbers in this case) underneath it. <table align="left" class="deftable" style= ...
Read more >Problem aligning columns in combined Word tables
To clean this mess up, proceed as follows: Go to the contextual TABLE TOOLS | LAYOUT tab that appears when you click anywhere...
Read more >Box alignment for block, absolutely positioned and table layout
In this page we explore how box alignment works in the context of block layout, including floated, positioned, and table elements.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s kind of an interaction of both. The only real solution would be to know what version of the unicode database the given terminal is using, and that’s just not exposed anywhere.
btw what terminal are you using? Those characters work fine in iTerm, Ubuntu, and Windows Terminal.
As you have discovered, the browser renders emoji differently from the terminal.
The only solution I have thought of would be to parse out emoji, and force them in to a span with a width that matches the terminal. I think that would work, but it will make the export function more complex.
It’s not high on my list of priorities. But if you file an issue for this I’ll Likely get to it eventually. Maybe sooner if I get sponsorship.