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

[BUG] Incorrect width calculation with Tamil language #2530

Closed
aroberge opened this issue Sep 19, 2022 · 8 comments
Closed

[BUG] Incorrect width calculation with Tamil language #2530

aroberge opened this issue Sep 19, 2022 · 8 comments

Comments

@aroberge
Copy link

You may find a solution to your problem in the docs or issues.

Describe the bug

When markdown text is written in Tamil, the width calculation is incorrect. This is very easy to see when the text is written in a Panel such as done in the included screenshot.

image

This is the first language in which I run into this issue. In addition to the English default, I have used French, Italian, Spanish, Hebrew, and Russian without noticing any such problems.

Platform

Click to expand

What platform (Win/Linux/Mac) are you running on? What terminal software are you using?

python -m rich.diagnose
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface.                                                  │
│                                                                                  │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=88 ColorSystem.TRUECOLOR>                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                  │
│     color_system = 'truecolor'                                                   │
│         encoding = 'utf-8'                                                       │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│           height = 45                                                            │
│    is_alt_screen = False                                                         │
│ is_dumb_terminal = False                                                         │
│   is_interactive = True                                                          │
│       is_jupyter = False                                                         │
│      is_terminal = True                                                          │
│   legacy_windows = False                                                         │
│         no_color = False                                                         │
│          options = ConsoleOptions(                                               │
│                        size=ConsoleDimensions(width=88, height=45),              │
│                        legacy_windows=False,                                     │
│                        min_width=1,                                              │
│                        max_width=88,                                             │
│                        is_terminal=True,                                         │
│                        encoding='utf-8',                                         │
│                        max_height=45,                                            │
│                        justify=None,                                             │
│                        overflow=None,                                            │
│                        no_wrap=False,                                            │
│                        highlight=None,                                           │
│                        markup=None,                                              │
│                        height=None                                               │
│                    )                                                             │
│            quiet = False                                                         │
│           record = False                                                         │
│         safe_box = True                                                          │
│             size = ConsoleDimensions(width=88, height=45)                        │
│        soft_wrap = False                                                         │
│           stderr = False                                                         │
│            style = None                                                          │
│         tab_size = 8                                                             │
│            width = 88                                                            │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭── <class 'rich._windows.WindowsConsoleFeatures'> ───╮
│ Windows features available.                         │
│                                                     │
│ ╭─────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=True, truecolor=True) │ │
│ ╰─────────────────────────────────────────────────╯ │
│                                                     │
│ truecolor = True                                    │
│        vt = True                                    │
╰─────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ {                                  │
│     'TERM': None,                  │
│     'COLORTERM': None,             │
│     'CLICOLOR': None,              │
│     'NO_COLOR': None,              │
│     'TERM_PROGRAM': None,          │
│     'COLUMNS': None,               │
│     'LINES': None,                 │
│     'JUPYTER_COLUMNS': None,       │
│     'JUPYTER_LINES': None,         │
│     'JPY_PARENT_PID': None,        │
│     'VSCODE_VERBOSE_LOGGING': None │
│ }                                  │
╰────────────────────────────────────╯
platform="Windows"
> python -m pip list
Package            Version
------------------ -------
appdirs            1.4.4
asttokens          2.0.5
colorama           0.4.5
commonmark         0.9.1
distro             1.6.0
executing          0.8.3
friendly-styles    0.2
friendly-traceback 0.6.0
pip                22.2.2
platformdirs       2.5.2
psutil             5.8.0
pure-eval          0.2.1
py-cpuinfo         8.0.0
Pygments           2.13.0
rich               12.5.1
setuptools         58.1.0
six                1.16.0
stack-data         0.5.0
textual            0.1.15
tiptop             0.1.2
@willmcgugan
Copy link
Collaborator

Seems to work here (on MacOS), with some Tamil I copied from Google translate. Could be Windows related.

You you send me the text in the screenshot.

@aroberge
Copy link
Author

Here's the text copied from a terminal:

ஒரு மதிப்பை சுழியத்தால் நேரடியாகவோ அல்லது வேறு சில கணிதச் செயல்பாட்டைப்
பயன்படுத்தியோ வகுக்க முயற்சிக்கும்போது சுழியவகுத்தல்பிழை ZeroDivisionError
ஏற்படுகிறது.

Here's a different screen shot:
image

And here it is copied from the .po file:

ஒரு மதிப்பை சுழியத்தால் நேரடியாகவோ அல்லது வேறு சில கணிதச் 
செயல்பாட்டைப் பயன்படுத்தியோ வகுக்க முயற்சிக்கும்போது சுழியவகுத்தல்பிழை `ZeroDivisionError` ஏற்படுகிறது.

@willmcgugan
Copy link
Collaborator

That prints ok in a Panel on MacOS.

Still looking like a Windows Terminal bug. I'll see if I can reproduce it on Windows.

Screenshot 2022-09-20 at 11 44 59

@aroberge
Copy link
Author

The last screenshot I included was not in a Panel, and the output was also wrong. Like you, I suspect it might be something wrong in a Windows Terminal.

@willmcgugan
Copy link
Collaborator

Maybe file an issue on the WT repo. I've found them to be pretty responsive.

@aroberge
Copy link
Author

Will do.

@aroberge
Copy link
Author

Searching the Window Terminal issues, I found a closed related one (microsoft/terminal#9490) which lead to some work in progress (microsoft/terminal#8000 and microsoft/terminal#1472)

@github-actions
Copy link

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants