-
Notifications
You must be signed in to change notification settings - Fork 300
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
PSReadLine doesn't respect cursor position when using cmd+k
or cmd+l
on macOS
#4074
Comments
PSReadLine doesn't handle the case where the cursor is moved from outside of PSReadLine (cursor movement from a custom key handler is also considered outside of PSReadLine). It doesn't simply write at the current cursor position but tracking the initial cursor position and calculate where it should render for the text. So, I'd say the reported scenario is not supported. |
Thanks for the reply @daxian-dbw. In that case, what is the proper mechanism for adjusting the cursor position of PSReadline? |
PSReadLine's cursor position is supposed to be adjusted only by its cursor movement key bindings, such as Home, End, LeftArrow, Ctrl+LeftArrow, and etc. |
that seems like a pretty limited view of what one can do in a terminal, and by extension what PSReadline should be obligated to handle. There are multiple cases when a terminal application can change the position of the cursor, and it seems like a poor user experience to ignore those. As another example, hitting Cmd+K or Cmd+L in the Mac terminal app clears the screen, and in the case of Cmd+K moves the cursor to the top of the screen along with a fresh prompt. PSReadline does not respect this and continues typing in the last location. It seems like PSReadline should either respect the current cursor position within the terminal, or it should have an API that allows the cursor position to be moved. |
cmd+k
or cmd+l
on macOS
PSReadLine handles cursor movement due to resizing of the terminal window and a special case where a TUI clears the screen (see code here). But unfortunately, it doesn't handle But I think we should support |
Prerequisites
Exception report
N/A
Screenshot
Screen.Recording.2024-07-16.at.3.41.21.PM.mov
Environment data
Steps to reproduce
Clear-Host
Hit
Ctrl+a
. Your cursor should now be at position 5,5Type
Write-Output
Expected behavior
The shell would display
Write-Output
starting at position 5,5Actual behavior
The cursor moves back to position 1,1 and displays
Write-Output
thereThe text was updated successfully, but these errors were encountered: