Last active
April 26, 2022 06:31
-
-
Save bryant1410/f134401c5866e96a81a7991678779f57 to your computer and use it in GitHub Desktop.
Quick workaround to change PyCharm's remote terminal width
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://youtrack.jetbrains.com/issue/PY-40900#focus=streamItem-27-4082296.0-0 | |
width = 215; print("Terminal width:", width) | |
if sys.stdout.isatty(): | |
import fcntl, struct, sys, termios; fcntl.ioctl(sys.stdin, termios.TIOCSWINSZ, struct.pack("HHHH", 0, width, 0, 0)) | |
else: # In case it's not remote. | |
import os; os.environ["COLUMNS"] = str(width) # It doesn't work everywhere, but it's something. | |
os.environ["LINES"] = "21" # Some programs need both env vars set for any to work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment