Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textual 2.0 regression: Emoji shortcodes no longer work in labels #5545

Closed
godlygeek opened this issue Feb 16, 2025 · 5 comments
Closed

Textual 2.0 regression: Emoji shortcodes no longer work in labels #5545

godlygeek opened this issue Feb 16, 2025 · 5 comments

Comments

@godlygeek
Copy link

This program:

from textual.app import App, ComposeResult
from textual.widgets import Label


class LabelApp(App):
    def compose(self) -> ComposeResult:
        yield Label(":joy:")


if __name__ == "__main__":
    app = LabelApp()
    app.run()

looks like this with Textual 2.0:

Image

but like this with Textual 1.x:

Image

Is this intentional or a regression? I don't see it documented in the changelog.

textual diagnose output:

# Textual Diagnostics

## Versions

| Name    | Value  |
|---------|--------|
| Textual | 2.0.3  |
| Rich    | 13.9.4 |

## Python

| Name           | Value                                           |
|----------------|-------------------------------------------------|
| Version        | 3.13.1                                          |
| Implementation | CPython                                         |
| Compiler       | Clang 18.1.8                                    |
| Executable     | /home/godlygeek/3ps/textual/venv/bin/python3.13 |

## Operating System

| Name    | Value                                                  |
|---------|--------------------------------------------------------|
| System  | Linux                                                  |
| Release | 6.6.67-06628-g571b599e617d                             |
| Version | #1 SMP PREEMPT_DYNAMIC Mon, 27 Jan 2025 12:44:48 -0800 |

## Terminal

| Name                 | Value           |
|----------------------|-----------------|
| Terminal Application | tmux (3.3a)     |
| TERM                 | screen-256color |
| COLORTERM            | *Not set*       |
| FORCE_COLOR          | *Not set*       |
| NO_COLOR             | *Not set*       |

## Rich Console options

| Name           | Value                |
|----------------|----------------------|
| size           | width=227, height=50 |
| legacy_windows | False                |
| min_width      | 1                    |
| max_width      | 227                  |
| is_terminal    | True                 |
| encoding       | utf-8                |
| max_height     | 50                   |
| justify        | None                 |
| overflow       | None                 |
| no_wrap        | False                |
| highlight      | None                 |
| markup         | None                 |
| height         | None                 |
Copy link

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@godlygeek
Copy link
Author

Bisecting tells me that this behavior change was introduced in c9102ae

@willmcgugan
Copy link
Collaborator

The new content system doesn't process emoji shortcodes. Experience has taught me that devs get irate when it happens accidentally. You can return Text.from_markup(":joy:") or cut and paste the emoji.

I've updated the release notes accordingly.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@willmcgugan
Copy link
Collaborator

Another option:

from rich.emoji import Emoji
Emoji.replace(":joy:")

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

No branches or pull requests

2 participants