-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Description
Windows Terminal version
n/a
Windows build number
10.0.19041.1348
Other Software
No response
Steps to reproduce
- Open a cmd shell in conhost.
- Run the C++ example further down in the comments: link.
The Python example below does not reproduce the issue reliably on all systems.
import math
import os
import sys
size = os.popen('stty size', 'r').read().split()
h,w = tuple(int(n) for n in size)
mx = w//2
my = h//2
def frame(i):
s = '\033[H'
for y in range(h):
for x in range(w):
dy,dx = y-my,x-mx
a = math.atan2(dy*2,dx) + math.pi
c = (int(a/math.pi*127)+i)%256
s += '\033[38;2;%d;%d;%dm*' % (c,c,c)
return s
sys.stdout.write('Generating content...\n')
s = '\033[?25l'
for i in range(512):
s += frame(i)
s += '\033[?25h\033[m\033[H'
sys.stdout.write('Starting animation...\n')
sys.stdout.write(s)
This constructs a little VT animation which it outputs with a single write
call.
Expected Behavior
You should see a rotating pattern, a bit like a radar scan. This is what it looks like in MinTTY (using wsltty):
Rotate.mp4
You'll see the same sort of thing in XTerm, VTE, Alacritty, Kitty, etc.
Actual Behavior
Conhost displays the first couple of lines of the first frame (if anything), then hangs for a couple of seconds, and eventually just shows the final frame.
Windows Terminal is a little better, in that it doesn't hang, but you still don't see the animation - just the final frame.
I believe the problem is that the buffer is locked for the entire time that the VT parser is processing a write operation, and the render thread can't render anything when it can't obtain the lock. If the write buffer is particularly large (as is the case here), then the renderer may be blocked for quite a long time.