From ec9308b3b4de43c4774c888ddd55e646aac9eb73 Mon Sep 17 00:00:00 2001 From: abgox Date: Sat, 30 Nov 2024 13:53:21 +0800 Subject: [PATCH] fix(module): update version to 5.1.4 --- module/CHANGELOG-CN.md | 4 ++++ module/CHANGELOG.json | 13 +++++++++++++ module/CHANGELOG.md | 4 ++++ module/PSCompletions/PSCompletions.psd1 | 2 +- module/PSCompletions/core/completion/win.ps1 | 19 +++++++++++++++++++ module/PSCompletions/core/init.ps1 | 11 +---------- module/version.txt | 2 +- 7 files changed, 43 insertions(+), 12 deletions(-) diff --git a/module/CHANGELOG-CN.md b/module/CHANGELOG-CN.md index 57cd5e0..a9cc29d 100644 --- a/module/CHANGELOG-CN.md +++ b/module/CHANGELOG-CN.md @@ -3,6 +3,10 @@ 简体中文

+## 5.1.4 (2024/11/30) + +- 修复了在 `v5.1.3` 中,混合使用 `PowerShell` 和 `Windows PowerShell` 导致边框样式被意外更改的问题。 + ## 5.1.3 (2024/11/30) - 修复拥有 `hooks.ps1` 的补全命令的动态补全不生效的问题。 diff --git a/module/CHANGELOG.json b/module/CHANGELOG.json index f692bfb..65dca49 100644 --- a/module/CHANGELOG.json +++ b/module/CHANGELOG.json @@ -1,4 +1,17 @@ [ + { + "version": "5.1.4", + "info": { + "zh-CN": [ + "更新(2024/11/30)\n", + "- 修复了在 v5.1.3 中,混合使用 PowerShell 和 Windows PowerShell 导致边框样式被意外更改的问题。\n" + ], + "en-US": [ + "Update(2024/11/30)\n", + "- Fix the issue of unexpected border style change when using PowerShell and Windows PowerShell together in v5.1.3.\n" + ] + } + }, { "version": "5.1.3", "info": { diff --git a/module/CHANGELOG.md b/module/CHANGELOG.md index 104a1c7..c56d171 100644 --- a/module/CHANGELOG.md +++ b/module/CHANGELOG.md @@ -3,6 +3,10 @@ English

+## 5.1.4 (2024/11/30) + +- Fix the issue of unexpected border style change when using `PowerShell` and `Windows PowerShell` together in `v5.1.3`. + ## 5.1.3 (2024/11/30) - Fix the issue of dynamic completion not taking effect for commands with `hooks.ps1`. diff --git a/module/PSCompletions/PSCompletions.psd1 b/module/PSCompletions/PSCompletions.psd1 index 64fb8d0..bef620e 100644 --- a/module/PSCompletions/PSCompletions.psd1 +++ b/module/PSCompletions/PSCompletions.psd1 @@ -9,7 +9,7 @@ @{ RootModule = 'PSCompletions.psm1' - ModuleVersion = '5.1.3' + ModuleVersion = '5.1.4' GUID = '00929632-527d-4dab-a5b3-21197faccd05' diff --git a/module/PSCompletions/core/completion/win.ps1 b/module/PSCompletions/core/completion/win.ps1 index d0ff4c1..174b4ee 100644 --- a/module/PSCompletions/core/completion/win.ps1 +++ b/module/PSCompletions/core/completion/win.ps1 @@ -9,6 +9,16 @@ return } + # XXX: 在 Windows PowerShell 5.x 中,边框使用以下符号以处理兼容性问题 + if ($PSEdition -ne 'Core') { + $PSCompletions.config.horizontal = '-' + $PSCompletions.config.vertical = '|' + $PSCompletions.config.top_left = '+' + $PSCompletions.config.bottom_left = '+' + $PSCompletions.config.top_right = '+' + $PSCompletions.config.bottom_right = '+' + } + # 是否是按下空格键触发的补全 $space_tab = if ($buffer[-1] -eq ' ') { 1 }else { 0 } # 使用正则表达式进行分割,将命令行中的每个参数分割出来,形成一个数组, 引号包裹的内容会被当作一个参数,且数组会包含 "--" @@ -140,6 +150,15 @@ $filter_list = $PSCompletions.get_completion() if ($PSCompletions.config.enable_menu -eq 1) { + # XXX: 在 Windows PowerShell 5.x 中,边框使用以下符号以处理兼容性问题 + if ($PSEdition -ne 'Core') { + $PSCompletions.config.horizontal = '-' + $PSCompletions.config.vertical = '|' + $PSCompletions.config.top_left = '+' + $PSCompletions.config.bottom_left = '+' + $PSCompletions.config.top_right = '+' + $PSCompletions.config.bottom_right = '+' + } $PSCompletions.menu.show_module_menu($filter_list) } else { diff --git a/module/PSCompletions/core/init.ps1 b/module/PSCompletions/core/init.ps1 index ee600eb..5916870 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.1.3' + version = '5.1.4' path = @{ root = $_ completions = Join-Path $_ 'completions' @@ -1062,15 +1062,6 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod init_data { $language = if ($PSCompletions.language -eq 'zh-CN') { 'zh-CN' }else { 'en-US' } $PSCompletions.info = $PSCompletions.ConvertFrom_JsonToHashtable($PSCompletions.get_raw_content("$($PSCompletions.path.completions)/psc/language/$language.json")).info } - # XXX: 在 Windows PowerShell 5.x 中,边框使用以下符号以处理兼容性问题 - if ($PSEdition -ne 'Core') { - $PSCompletions.config.horizontal = '-' - $PSCompletions.config.vertical = '|' - $PSCompletions.config.top_left = '+' - $PSCompletions.config.bottom_left = '+' - $PSCompletions.config.top_right = '+' - $PSCompletions.config.bottom_right = '+' - } } Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod get_length { param([string]$str) diff --git a/module/version.txt b/module/version.txt index cdb98d2..76e9e61 100644 --- a/module/version.txt +++ b/module/version.txt @@ -1 +1 @@ -5.1.3 +5.1.4