PSReadLine
PSReadLine copied to clipboard
PSReadLine doesn't respect cursor position when using `cmd+k` or `cmd+l` on macOS
Prerequisites
- [X] Write a descriptive title.
- [X] Make sure you are able to repro it on the latest released version
- [X] Search the existing issues, especially the pinned issues.
Exception report
N/A
Screenshot
https://github.com/user-attachments/assets/7b4612e4-e6ae-4fb5-b24d-b9aeefcdd429
Environment data
PS Version: 7.4.2
PS HostName: ConsoleHost
PSReadLine Version: 2.3.5
PSReadLine EditMode: Emacs
OS: Darwin Dans-MacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64
BufferWidth: 80
BufferHeight: 24
Steps to reproduce
- Set the following key handler
Set-PSReadlineKeyHandler -Chord 'Control+a' -ScriptBlock {
[Console]::SetCursorPosition(5, 5)
}
- Set prompt to null
function prompt { "`0" }
- Clear screen. Your cursor should now be in the top left corner
Clear-Host
-
Hit
Ctrl+a
. Your cursor should now be at position 5,5 -
Type
Write-Output
Expected behavior
The shell would display Write-Output
starting at position 5,5
Actual behavior
The cursor moves back to position 1,1 and displays Write-Output
there