-
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
Incorrect cursor position on full lines #15888
Comments
Thanks for reporting this! You'd be surprised -- this is actually working as intended! Applications are allowed to write text all the way to the edge of the screen without incurring line wrapping. However, the cursor cannot go off the edge of the screen to indicate that the next character will go into outer space. Different terminal emulators handle this differently: It looks funny when the default cursor is set to the vertical bar... but the cursor technically occupies a cell, and not a place between cells. /cc @j4james, as I am probably getting some details wrong 😄 |
In your case (@pere3), the position of the cursor is controlled by vim. 😄 |
Hey DHowett, thanks for taking the time to respond and spread some knowledge 😊:
Hmm that's fair. I guess I was just used to the behavior of the original console where even the full sized cursor would wrap: If I remember the console APIs correctly this is a behavior the app can choose to override but idk, to me it makes more sense for the cursor to always display where it is but maybe there is nothing saying that's how it's supposed to be. There is another inconsistency I've noticed with the way the end of line is handled. If you type to the end of a line like this: You can press the right arrow and nothing happens, as would be expected given the current positioning logic. If you instead press left then right (i.e., leave the position and return back to it) the cursor follows the "move to next line" behavior even though the position is the same as before when it followed the "stay at end of line" behavior: I'm not sure if this behavior is inherent to the way the line wrapping logic is supposed to work in this method but it certainly feels inconsistent to someone unfamiliar. @DHowett I'll leave it up to you to divine if this second behavior would be categorized as a bug or not. In either scenario, I'd like to make the case that it (feels) more consistent to just wrap the cursor to the next line as the default behavior, if both are valid, but agree that may not fit under the "bug" tag. |
@DHowett I think there's more to this, though, because it works differently in conhost. I had a brief look at what was going on and it appears that pwsh is using a mix of VT and legacy APIs. When you type a character at the end of the line, it redraws the line in VT mode, leaving the cursor in the last column. But it also then calls |
Huh! I get to be the one who is surprised! Thanks for looking, James. 😄 |
I was looking through other issues and couldn't find an answer to that, so... BTW while writing this I just noticed that our margins aren't quite uniform... |
If we do, it should definitely be an option, preferably off by default, because from a standards point of view that's just wrong. When the terminal is in this state, the cursor position is explicitly defined as the last column. The reported position is going to be the last column. Any movement operation is going to be relative to the last column. If you're rendering the cursor somewhere else, it's going to appear broken. Maybe it's a personal preference, but if I saw a terminal doing this I'd assume it was a bug. |
Windows Terminal version
1.7.11461.0
Windows build number
10.0.22621.0
Other Software
No response
Steps to reproduce
Create a character string which is one character short of the full line width:
Add the final character and note the cursor appears one character left of where it should:
Expected Behavior
Cursor should appear at the end of the line when the line is full.
Actual Behavior
Cursor appears one character before the end of the line. Operationally the cursor functions according to the correct position ("delete" does nothing and "backspace" removes the "L"). This is an off-by-one error on just the display side.
The text was updated successfully, but these errors were encountered: