prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.32k stars 714 forks source link

Add auto wordwrap for StdoutProxy #1483

Open AnzhiZhang opened 3 years ago

AnzhiZhang commented 3 years ago

When I using Windows Terminal run cmd, run this code:

from prompt_toolkit.patch_stdout import patch_stdout

with patch_stdout():
    for i in range(100):
        print('a' * i)

If characters are too many longer than one line, extra part will be cut.

There is expected behavior There is actual behavior

AnzhiZhang commented 3 years ago

This bug will run only on Windows Terminal(sorry i am on chinese win): image

It is not dependent of run cmd or Powershell in Terminal

I-love-study commented 2 years ago

In fact, I can get same error in both Windows Console Host and Windows Terminal (1.12.10334.0) on Windows 11 by using the script below

from prompt_toolkit.patch_stdout import patch_stdout

with patch_stdout():
    print('a' * 300)

(I'm also in a Chinese Win)

image image image
BlueGlassBlock commented 2 years ago

Perhaps this issue should be called "Add auto wordwrap for StdoutProxy"

GreyElaina commented 2 years ago

This problem is caused by Vt100_Output...

GreyElaina commented 2 years ago

i fix this issue on my branch: https://github.com/GreyElaina/python-prompt-toolkit

AnzhiZhang commented 1 year ago

Hello, is anyone working on this issue?