Update the sample in README.md to work in strict mode (#3440)

This commit is contained in:
Dongbo Wang
2022-09-22 10:39:01 -07:00
committed by GitHub
parent cb0e0d4735
commit ea25286b86
+1 -1
View File
@@ -187,7 +187,7 @@ Set-PSReadLineKeyHandler -Chord '"',"'" `
$cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)
if ($line[$cursor] -eq $key.KeyChar) {
if ($line.Length -gt $cursor -and $line[$cursor] -eq $key.KeyChar) {
# Just move the cursor
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($cursor + 1)
}