It turns out that PowerShell Core 6.0.1 ships with version 1.2 of the PSReadLine module, as seen by Get-Module PSReadLine
, but the fix was in https://github.com/lzybkr/PSReadLine/releases/tag/v2.0.0-beta1. Seeing as that release says:
This is the first release from the repo supporting both PowerShell Core (all platforms) and Windows PowerShell.
I assumed I had that version and didn't check originally.
To get it working with that version, one can use:
Set-PSReadLineKeyHandler -Key Delete `
-BriefDescription Delete `
-LongDescription "Delete character over the caret" `
-ScriptBlock {
param($key, $arg)
$line = $null
$cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($cursor -lt $line.Length)
{
[Microsoft.PowerShell.PSConsoleReadLine]::Delete($cursor, 1)
}
}
(ideally by placing it in the appropriate profile file so that it is auto-run when PowerShell starts.)
This can also be fixed by upgrading the PSReadLine module, using the instructions at https://github.com/lzybkr/PSReadLine/issues/612, which are:
Install-Module PSReadLine -RequiredVersion 2.0.0-beta1 -AllowPrerelease -Scope CurrentUser -SkipPublisherCheck
Presumably a future release of PowerShell Core will include a fixed version of the PSReadLine module.
Best Answer
Ok I'm stupid.
I have DoubleCommand installed, and I, for some reason, enabled the "shift+delete acts as forward delete" command. Apologies.