PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

PSReadLine doesn't respect cursor position when using `cmd+k` or `cmd+l` on macOS

Open daprahamian opened this issue 7 months ago • 5 comments

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

  1. Set the following key handler
Set-PSReadlineKeyHandler -Chord 'Control+a' -ScriptBlock {
  [Console]::SetCursorPosition(5, 5)
}
  1. Set prompt to null
function prompt { "`0" }
  1. Clear screen. Your cursor should now be in the top left corner
Clear-Host
  1. Hit Ctrl+a. Your cursor should now be at position 5,5

  2. 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

daprahamian avatar Jul 16 '24 19:07 daprahamian