diff --git a/module/CHANGELOG-CN.md b/module/CHANGELOG-CN.md index 8d8fa95..07f2c07 100644 --- a/module/CHANGELOG-CN.md +++ b/module/CHANGELOG-CN.md @@ -3,6 +3,11 @@ 简体中文
+## 5.0.6 (2024/10/26) + +- 修复了目录路径补全没有尾部路径分隔符的问题 +- 其他的优化和修复。 + ## 5.0.5 (2024/9/2) - 在 `$PSCompletions` 中添加一个方法 `return_completion` 用于 `hooks.ps1`。 diff --git a/module/CHANGELOG.json b/module/CHANGELOG.json index de0ead8..33b7c45 100644 --- a/module/CHANGELOG.json +++ b/module/CHANGELOG.json @@ -1,4 +1,19 @@ [ + { + "version": "5.0.6", + "info": { + "zh-CN": [ + "修复(2024/10/26)\n", + "- 修复了目录路径补全没有尾部路径分隔符的问题。\n", + "- 其他的优化和修复。\n" + ], + "en-US": [ + "Fix(2024/10/26)\n", + "- Fix directory path completion without trailing path separators.\n", + "- Other optimizations and fixes.\n" + ] + } + }, { "version": "5.0.5", "info": { diff --git a/module/CHANGELOG.md b/module/CHANGELOG.md index e960329..131cd46 100644 --- a/module/CHANGELOG.md +++ b/module/CHANGELOG.md @@ -3,6 +3,11 @@ English +## 5.0.6 (2024/10/26) + +- Fix directory path completion without trailing path separators. +- Other optimizations and fixes. + ## 5.0.5 (2024/9/2) - Add a method `return_completion` in `$PSCompletions` for `hooks.ps1`. diff --git a/module/PSCompletions/PSCompletions.psd1 b/module/PSCompletions/PSCompletions.psd1 index fb43f89..afa7084 100644 --- a/module/PSCompletions/PSCompletions.psd1 +++ b/module/PSCompletions/PSCompletions.psd1 @@ -9,7 +9,7 @@ @{ RootModule = 'PSCompletions.psm1' - ModuleVersion = '5.0.5' + ModuleVersion = '5.0.6' GUID = '00929632-527d-4dab-a5b3-21197faccd05' @@ -22,6 +22,7 @@ CompatiblePSEditions = @('Core', 'Desktop') Description = 'A completion manager for better and simpler use PowerShell completions. + It provides a better GUI-style tab-completion menu to enhance the command line experience. For more information, please visit the project or website: - Website: https://pscompletions.pages.dev - Github: https://github.com/abgox/PSCompletions diff --git a/module/PSCompletions/core/init.ps1 b/module/PSCompletions/core/init.ps1 index 664b6d0..f5a5545 100644 --- a/module/PSCompletions/core/init.ps1 +++ b/module/PSCompletions/core/init.ps1 @@ -1,7 +1,7 @@ using namespace System.Management.Automation $_ = Split-Path $PSScriptRoot -Parent New-Variable -Name PSCompletions -Value @{ - version = '5.0.5' + version = '5.0.6' path = @{ root = $_ completions = Join-Path $_ 'completions' @@ -14,6 +14,7 @@ New-Variable -Name PSCompletions -Value @{ order = [ordered]@{} language = $PSUICulture encoding = [console]::OutputEncoding + separator = [System.IO.Path]::DirectorySeparatorChar wc = New-Object System.Net.WebClient menu = @{ const = @{ @@ -1013,7 +1014,7 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod init_data { $PSCompletions.list = ($PSCompletions.get_raw_content($PSCompletions.path.completions_json) | ConvertFrom-Json).list $PSCompletions.update = $PSCompletions.get_content($PSCompletions.path.update) - if ($PSCompletions._update_version -or 'psc' -notin $PSCompletions.data.list) { + if ('psc' -notin $PSCompletions.data.list -or $PSCompletions._update_version) { $PSCompletions.add_completion('psc', $false, $false) $PSCompletions.data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8 $PSCompletions._update_version = $null diff --git a/module/PSCompletions/core/menu/win.ps1 b/module/PSCompletions/core/menu/win.ps1 index bf5e5de..8d5ba65 100644 --- a/module/PSCompletions/core/menu/win.ps1 +++ b/module/PSCompletions/core/menu/win.ps1 @@ -631,6 +631,20 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod reset { Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module_menu { param($filter_list, [bool]$enable_menu_enhance) + function handleOutput($item) { + $out = $item.CompletionText + try { + if ((Get-ItemProperty ($item.ToolTip)).Attributes -like '*Directory*') { + if ($out -like "* *") { + return $out.Insert($out.Length - 1, $PSCompletions.separator) + } + return $out + $PSCompletions.separator + } + } + catch {} + return $out + } + if (!$filter_list) { return } $lastest_encoding = [console]::OutputEncoding @@ -659,7 +673,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module $PSCompletions.menu.handle_list_first($filter_list) if ($PSCompletions.config.enable_enter_when_single -and $PSCompletions.menu.filter_list.Count -eq 1) { - return $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index].CompletionText + return handleOutput $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index] } $PSCompletions.menu.parse_list() @@ -748,7 +762,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module } 13 { # 13: Enter - $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index].CompletionText + handleOutput $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index] $PSCompletions.menu.reset($true) break loop } diff --git a/module/version.txt b/module/version.txt index ab0fa33..c20c645 100644 --- a/module/version.txt +++ b/module/version.txt @@ -1 +1 @@ -5.0.5 +5.0.6