-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
Windows Terminal version
1.17.1023
Windows build number
10.0.19044.2364
Other Software
No response
Steps to reproduce
- Start a bash shell in Windows Terminal.
- Make sure your screen width is an even number of columns.
- Execute
clearto make sure he screen is cleared. - Execute
printf "\e#6\e[999Cv\e#5\n\e#6\e[999C*\e[B^\n"
Expected Behavior
The v and ^ characters should be in the same column, looking something like this:
Actual Behavior
The ^ character is one column to the left of v.
I'm almost sure this used to work in the past, so I suspect this might be fallout from one of the delayed EOL wrap fixes (possibly PR #14640 or PR #14936).
What's happening is the * is written at the end of a double-width line, so the cursor sets the delayed wrap flag, but doesn't move forward. However, conpty doesn't recognise that state, so it thinks the cursor is one column to the right of where it really is. Then when it needs to move down a row to output the ^, it uses a backspace to adjust the column offset, but that adjustment wasn't needed, so the ^ ends up in the wrong column.
I think the easiest fix for this would be to disable the conpty cursor optimisations whenever we've got double-width lines renditions on the page. That just requires adding the _usingLineRenditions flag to the condition here:
terminal/src/renderer/vt/XtermEngine.cpp
Lines 280 to 293 in b9248fa
| else if (_delayedEolWrap) | |
| { | |
| // GH#1245, GH#357 - If we were in the delayed EOL wrap state, make | |
| // sure to _manually_ position the cursor now, with a full CUP | |
| // sequence, don't try and be clever with \b or \r or other control | |
| // sequences. Different terminals (conhost, gnome-terminal, wt) all | |
| // behave differently with how the cursor behaves at an end of line. | |
| // This is the only solution that works in all of them, and also | |
| // works wrapped lines emitted by conpty. | |
| // | |
| // Make sure to do this _after_ the possible \r\n branch above, | |
| // otherwise we might accidentally break wrapped lines (GH#405) | |
| hr = _CursorPosition(coord); | |
| } |

