In PowerShell 6.0.1, the out-of-the-box behavior is that when I press Delete while my caret is not at the end of the line, it deletes the character above the caret, as expected. However, once I delete the last character on the line, it moves the caret back a position. I find this very annoying, because I can no longer just hold Delete to delete until the end of the line. Is there a way to change it so that it behaves the same as when I press EndDelete - i.e. it does nothing?
I then looked into keybindings, and ran
Get-PSReadLineKeyHandler to check what Delete is currently assigned to, and then searched for
DeleteChar in the
PSReadLine codebase, to see the definition for that function, and to browse around for something similar. I found DeleteCharOrExit, and ran
Set-PSReadLineKeyHandler -Key Delete -Function DeleteCharOrExit which doesn't exit the "delete" process - as I assumed from the unclear doc comment - it exits the PowerShell console process...
I also found https://github.com/lzybkr/PSReadLine/issues/486, which suggests it has been fixed, but clearly not...
Maybe I need to inject some custom keybinding code like https://github.com/lzybkr/PSReadLine/blob/46d232c22ac3f24a95e32d773c594ad306dfc327/PSReadLine/SamplePSReadLineProfile.ps1#L257-L291?