From e3aabfb7e412a0302c60539835d7da049cedf5b8 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 9 Jul 2024 14:29:15 -0400 Subject: [PATCH] Fix PowerShell completions not completing after directories containing spaces --- completions/powershell7plus/mutn.ps1 | 8 ++++---- wiki/MUTN/quirks.md | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/completions/powershell7plus/mutn.ps1 b/completions/powershell7plus/mutn.ps1 index 0f26b84..ac094a0 100644 --- a/completions/powershell7plus/mutn.ps1 +++ b/completions/powershell7plus/mutn.ps1 @@ -1,10 +1,10 @@ function cliMUTNEntryCompleter { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) #$mutnPath = (Resolve-Path '~/.local/share/libmutton').Path # UNIX testing - $mutnPath = (Resolve-Path '~/AppData/Local/libmutton/entries').Path + $mutnPath = (Resolve-Path '~\AppData\Local\libmutton\entries').Path try { $trimmedPaths = If (Test-Path $mutnPath) { - (Get-ChildItem -Path $mutnPath -Recurse -File).FullName.Substring($mutnPath.Length) -replace '\\', '/' -replace ' ', '` ' + (Get-ChildItem -Path $mutnPath -Recurse -File).FullName.Substring($mutnPath.Length) -replace '\\', '/' -replace ' ', [char]0x23bd } } catch { $trimmedPaths = $null # if any errors occur (especially, "You cannot call a method on a null-valued expression", set $trimmedPaths to $null @@ -50,6 +50,6 @@ function mutn { [string]$option ) - #Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` '), $argument, $option).Trim() # UNIX testing - Invoke-Expression -Command ('./mutn.exe ' + ($entry -replace ' ', '` '), $argument, $option).Trim() + #Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` ' -replace [char]0x1a, '` '), $argument, $option).Trim() # UNIX testing + Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` ' -replace [char]0x23bd, '` '), $argument, $option).Trim() } diff --git a/wiki/MUTN/quirks.md b/wiki/MUTN/quirks.md index fd068b9..ffc3915 100644 --- a/wiki/MUTN/quirks.md +++ b/wiki/MUTN/quirks.md @@ -1,7 +1,6 @@ ## Windows Quirks -MUTN for Windows is fully functional, though it does exhibit a few quirks/bugs not found on other platforms. Watch out for these, and if you have the know-how, pull requests addressing them are welcomed! +MUTN for Windows is fully functional, though it does exhibit a couple quirks/bugs not found on other platforms. Watch out for these, and if you have the know-how, pull requests addressing them are welcomed! - Reading entries (especially those containing Markdown notes) often results in failure to interpret ANSI escape codes, leading to the raw escape codes being dumped to stdout. This happens seemingly randomly and re-running the exact same command ALWAYS yields the correct output. It's like the terminal has to "warm up" to ASNI escape codes or something. **Help wanted**. - GPG is sometimes (seems unpredictable) incredibly slow to start on Windows (often after a reboot), leading to many operations seemingly hanging - **This will be addressed** in the migration off of GPG that will take place before v1.0.0 -- PowerShell tab completions will not complete after a directory name if the directory contains a space \ No newline at end of file