terminal
terminal copied to clipboard
Cursor droppings are back in conhost
Windows Terminal version
OpenConsole 8a34a0e59ac41bc805c308fb82bc7683e583d45d
Windows build number
10.0.19041.1415
Other Software
No response
Steps to reproduce
- You must be using a somewhat recent version of OpenConsole.
- Open a WSL bash shell.
- Execute the following:
printf "\e[2 q\e[9999C "; sleep 1
The CSI 2 q is to get a non-blinking cursor which makes the issue easier to produce. The CSI 9999C moves the cursor to the end of the line, and the space initiates a delayed wrap. The sleep then gives the cursor a chance to be rendered before the next output will trigger the actual wrap.
Expected Behavior
The output should wrap to the next line without leaving a visible cursor block behind.
Actual Behavior
The cursor at the end of the line isn't cleared when the output wraps, so you end up with two cursors visible on the screen.

This doesn't occur in my inbox version of conhost, so I think it might be a regression.
DROP EVERYTHING, THEY'RE BACK.
Thanks for noticing! Definitely can't let these back into the world 😝
I think this was broken by the deferred cursor drawing introduced in PR #10394. I can fix it by removing the StartDeferDrawing and EndDeferDrawing here:
https://github.com/microsoft/terminal/blob/f936c4443d4b7b11da32077b0dc0a9aa8652bc77/src/host/outputStream.cpp#L45-L55
But then we lose the performance improvements we were getting from the PR. Hopefully there's a way to fix it without undoing that completely.
I've got a possible solution that doesn't require undoing the deferred drawing. We save the current cursor position in StartDeferDrawing, and then trigger a redraw for both the old and new positions in EndDeferDrawing (assuming the position has changed).
Hopefully the overhead of that additional maintenance doesn't outweigh the benefits we're getting from the deferred drawing, but I'm not the best person to evaluate the performance issues here. I'm also not positive this is going to work in all scenarios - need to play around with it some more.
Fixing #12917 doesn't magically fix this 😢
Note: only repros when you're above the bottom of the viewport, so the view doesn't scroll
Might get fixed by snapshots
:tada:This issue was addressed in #14640, which has now been successfully released as Windows Terminal Preview v1.17.1023.:tada:
Handy links: