fix: set edit mode before ps readline key registration

This commit is contained in:
Stevan Freeborn
2026-07-17 23:05:43 -05:00
parent 9cee4bcc43
commit f2cf8467ef
2 changed files with 2 additions and 3 deletions
@@ -12,7 +12,6 @@ if (Test-Path -Path $ProfileDir) {
Write-Warning "Failed to load profile module: $($Script.Name). Error: $($_.Exception.Message)" Write-Warning "Failed to load profile module: $($Script.Name). Error: $($_.Exception.Message)"
} }
} }
} else { } else {
Write-Warning "Profile directory not found at: $ProfileDir" Write-Warning "Profile directory not found at: $ProfileDir"
} }
@@ -1,8 +1,9 @@
using namespace System.Management.Automation using namespace System.Management.Automation
using namespace System.Management.Automation.Language using namespace System.Management.Automation.Language
Import-Module PSReadLine -ErrorAction SilentlyContinue
if (Get-Command Set-PSReadLineOption -ErrorAction SilentlyContinue) { if (Get-Command Set-PSReadLineOption -ErrorAction SilentlyContinue) {
# Set EditMode Windows first to ensure all subsequent registrations target the correct keymap
Set-PSReadLineOption -EditMode Windows
# Searching for commands with up/down arrow is really handy. # Searching for commands with up/down arrow is really handy.
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
@@ -539,7 +540,6 @@ if (Get-Command Set-PSReadLineOption -ErrorAction SilentlyContinue) {
Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
# dotnet build macro # dotnet build macro
Set-PSReadLineKeyHandler -Key Ctrl+Shift+b ` Set-PSReadLineKeyHandler -Key Ctrl+Shift+b `