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

Tracking PyCharm/IntelliJ/CLion CSR issue #32

Open
dominick-han opened this issue Oct 8, 2020 · 5 comments
Open

Tracking PyCharm/IntelliJ/CLion CSR issue #32

dominick-han opened this issue Oct 8, 2020 · 5 comments

Comments

@dominick-han
Copy link

Describe the bug
enlighten doesn't seem to support "Terminal" in JetBrain's IDEs

To Reproduce
Run demo.py in the "Terminal" tab in PyCharm

Environment (please complete the following information):

  • Enlighten Version: 1.6.2
  • OS and version: MacOS 10.15.7
  • Console application: PyCharm 2020.2.3
  • Special Conditions: N/A

Additional context
Maybe I'm missing something? A brand new PyCharm install, and using the normal Terminal tab
Screen Shot 2020-10-08 at 11 43 51 AM

@avylove
Copy link
Contributor

avylove commented Oct 9, 2020

I'm not sure why this isn't working, but I've been able to replicate it. I'll try to dig in and figure out what's happening.

@avylove
Copy link
Contributor

avylove commented Oct 9, 2020

It seems this is a bug in the pycharm terminal's handling of CSR. Here is a script to illustrate the issue.

import sys
import blessed

term = blessed.Terminal()

# Set scroll region
sys.stdout.write(term.csr(0, 5))

# Print a line at the top of the terminal
sys.stdout.write(term.move(0, 0))
sys.stdout.write("Top of terminal")

# Print a line near the bottom of the terminal
sys.stdout.write(term.move(term.height - 2, 0))
sys.stdout.write(term.clear_eol + "Bottom of terminal")

# Reset terminal
sys.stdout.write(term.csr(0, term.height - 1))
sys.stdout.write(term.move(term.height, 0))

In a standard terminal you'll see a message at the top and bottom of the terminal. In PyCharm, you see

pycharm csr issue

@avylove avylove added Not a Bug and removed bug labels Oct 9, 2020
@avylove
Copy link
Contributor

avylove commented Oct 9, 2020

I created an issue to track this
https://youtrack.jetbrains.com/issue/PY-44864

@avylove avylove changed the title Support for PyCharm/IntelliJ/CLion Tracking PyCharm/IntelliJ/CLion CSR issue Oct 9, 2020
@dominick-han
Copy link
Author

dominick-han commented Oct 9, 2020

Thank you so much!
Would it (potentially) be an issue with blessed?

@avylove
Copy link
Contributor

avylove commented Oct 9, 2020

No, Blessed is just for convenience. On a terminal 25 lines high, this is the equivalent of

$ echo -en "\x1b[1;6r\x1b[1;1H\x1b[KTop of terminal\x1b[24;1H\x1b[KBottom of terminal\x1b[1;25r\x1b[26;1H"

or in Python

height = 25
print(f'\x1b[1;6r\x1b[1;1H\x1b[KTop of terminal\x1b[{height - 1};1H\x1b[KBottom of terminal\x1b[1;{height}r\x1b[{height + 1};1H', end='')

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