pythonterminalpycharm

Can the maximum line width in the terminal be increased in PyCharm?


In PyCharm, the terminal appears to have a maximum width of 265 characters.

To see this, run the following at a python prompt in the PyCharm terminal:

print('x' * 264)  # displays a long row of xxxxxxx on one line
print('x' * 265)  # wraps the newline character onto a new line
print('x' * 266)  # wraps one of the x's onto a new line

Is there a setting in PyCharm to increase this limit on line width?

I would like to print out lines that are longer than this, to compare with output from a different program.

I realise that I could write the output to a file from Python, but for quick debugging it is often convenient to print to the terminal.


Solution

  • In PyCharm, the terminal appears to have a maximum width of 265 characters.

    What PyCharm does is use a terminal emulator to call one of the terminals/shells installed on your system. So the properties are native to whatever terminal you configure the IDE to use. The terminal can be chosen at File > Settings > Tools > Terminal > Application Settings > Shell path, see the screenshot (in this example Windows cmd.exe).

    enter image description here

    Setting the column length is not PyCharm specific but something native to the terminal/shell/OS you are using. So setting this property will be different depending on your system, in the example using Windows cmd.exe it can be set using Microsoft mode as explained in this post. The screenshot shows the running example from the question.

    enter image description here