Duroktar / Wolf

Wolf is a VsCode extension that enables live inspection of Python code in the editor.
Other
129 stars 7 forks source link

[bug] nothing appears when printing more than 8190 characters #59

Open Almenon opened 3 years ago

Almenon commented 3 years ago

Works:

print('a'*8190)
# a's show up

Doesn't work:

print('a'*8191)
# a's don't show up

Interestingly the output log for the extension still shows characters, it just doesn't show up inline.

Other relevant info: Python on windows (or at least on my machine) has a buffer size of 8912 bytes so when there's 8193 bytes (8191 a's and a two-byte newline \r\n) there's two flushes. For some reason this breaks wolf. I'm guessing what happens is that wolf receives all the a's, then receives the newline, and writes just the invisible newline to the text decoration, but I'm not sure.

You can check the buffer size by running: python -c "import io;print(io.DEFAULT_BUFFER_SIZE)"

It should also be noted that you are not guaranteed a 'data' event from the process every flush - see https://github.com/nodejs/node/issues/33465

Duroktar commented 3 years ago

Thanks! Will check this out today..