-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor position is lost when resizing the window if not on the bottom line #10848
Comments
This is because we'll end up circling the buffer during the resize, after we found the cursor position. Say the window has 20 rows. That puts the cursor on row 18. When we resize down, and reflow the buffer, we'll look for the old cursor. We'll find it at (0,18) in the old buffer, when we're writing to (0,19) in the new buffer. This is because So we'll stash (0,19) as the expected cursor position in the new buffer. We'll reflow this whole line into the buffer, which will cause us to circle! The place the cursor should really be is line 17, not 19. I'm putting this in the same bucket as #10130/#6546. I think this is gonna just go away with #8000, though we're probably "out of the frying pan, into the fire" with that one |
Same here... I can't seem to reproduce this issue in 1.17/1.18. Did we fix this? |
(Sorry for the other comment I posted here - I meant to post it in #10868.) I believe this issue as described is fixed, but #14448 gave me an idea for reproducing a similar, probably related issue. @echo off
set /p "ANSWER=Could you share maybe a screenshot/? What shell are you using, and/or what program is doing the outputting? I bet this is #3088 just based on the description, but I can't be sure." and by resizing the window randomly it is possible to place the cursor in the wrong position. From what I can tell, the issue is due to a desync between ConPTY and Windows Terminal, because Windows Terminal doesn't resize its buffer at the same time as ConPTY. This most obvious when actively printing text of course, but it also happens when regularly resizing. I believe my PR #15701 exacerbates this issue, because the reflow is so much faster giving more time for a desync to happen. Edit: Additionally, there's the issue that ConPTY has no scrollback and so line wrapping behaves differently leading to #14448. But what I meant is an actual cursor misplacement even if the buffer is mostly empty. Here for instance, I just have 2 long lines and never hit the scrollback in ConPTY, and still, the output is corrupted ("ConsoleMonitor" shows the internal buffer of ConPTY): But as I said, I believe that the two issues you filed, as they're described, are fixed, even if reflow in general is still buggy. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
1 similar comment
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
Windows Terminal version (or Windows build number)
10.0.19042.1110 (windows terminal 1.9.1942.0)
Other Software
No response
Steps to reproduce
If the cursor position is not on the last line (of the input), making the screen more narrow will push the cursor down to the last line when lines wrap and the original position is lost; on a resize to make it wider again it stays on the last line.
This affects utilities like "readline" when editing multiple lines of input. Hope it can be fixed as it makes multiline editing not work at all.
To reproduce, run the following batch file:
(note: I think the paste lost it but there should be an
ESC
character in front of the[
characters to make the escape sequence function; theESC[1F
moves the cursor one up so it is no longer on the last line.)Expected Behavior
The cursor should always stay at the same point in the input regardless of a window resize. The "old" cmd terminal is correct and the cursor stays at the same point..
Actual Behavior
Here you see the cursor in Windows Terminal (I made it red) move down a line on the resize and lose its position.
The text was updated successfully, but these errors were encountered: