question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emojis in tables messes up the column alignment

See original GitHub issue

My 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.

image

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Jul 8, 2020

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.

0reactions
willmcgugancommented, Sep 18, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found