[go: nahoru, domu]

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] Long link address is incorrect when it breaks into two lines in PyCharm #3036

Open
2 tasks done
xin-flex opened this issue Jul 14, 2023 · 2 comments
Open
2 tasks done

Comments

@xin-flex
Copy link

Describe the bug

There are two visible issues:

  1. If the displayed text is not "url-like", in PyCharm it will not be clickable. In Jupyter Lab it works fine.
  2. When the displayed text is too long and breaks into two lines:
    2.1. In PyCharm, the actual link address will contain only the first line which is incorrect.
    2.2. In Jupyter Lab the actual link address is complete and correct, but when I hover over the link with mouse, only the current line will show an underscore, while I expected to see both lines of the link underscored. (This is a minor cosmetic issue.)

Code
from rich import print
url = "https://www.google.com/search?q=test"
text_url = "https://www.google.com/search?q=test123"
text_long = "https://www.google.com/search?q=test1aaaaaaaaaaaaaaaaaaaaaaaaaaaddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffff"
text = "aaaaaccccccc"
print(f"My short link: [link={url}]{text_url}[/link]")
print(f"My long link: [link={url}]{text_long}[/link]")
print(f"My long link: [link={url}]{text}[/link]")

Output of the code

PyCharm output (for issue 1 and 2.1): link address contains only first line's content (https://www.google.com/search?q=test1aaaaaaaaaaaaaaaaaaaaaaaaaaaddddddddeeeeeee)
image

JupyterLab output (for issue 2.2): only the first line has underscore when I hover over the first line
image

Platform

Click to expand

What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
rich version: 12.5.1
PyCharm version: 2022.2.2
OS: Window 11

┌────────────────────── <class 'rich.console.Console'> ───────────────────────┐
│ A high level console interface. │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ color_system = None │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='' mode='w' │
│ encoding='utf-8'> │
│ height = 25 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = False │
│ is_jupyter = False │
│ is_terminal = False │
│ legacy_windows = True │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=79, height=25), │
│ legacy_windows=True, │
│ min_width=1, │
│ max_width=79, │
│ is_terminal=False, │
│ encoding='utf-8', │
│ max_height=25, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=79, height=25) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 79 │
└─────────────────────────────────────────────────────────────────────────────┘
┌─── <class 'rich._windows.WindowsConsoleFeatures'> ────┐
│ Windows features available. │
│ │
│ ┌───────────────────────────────────────────────────┐ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ └───────────────────────────────────────────────────┘ │
│ │
│ truecolor = False │
│ vt = False │
└───────────────────────────────────────────────────────┘
┌────── 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"

Process finished with exit code 0

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

For PyCharm I suspect that it doesn't support terminal links escape sequences, and it is merely making something that looks like a link clickable. You would get the same behaviour if you omitted [link] entirely.

The issue in Jupyter lab is probably incomplete support for terminal links.

Given that it works in a "real" terminal, it indicates that Rich is generating the correct output. You might want to report these to the maintainers of PyCharm and Jupyter lab.

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