Skip to content

Commit

Permalink
fix(module): update version to 4.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
abgox committed Aug 9, 2024
1 parent 49230cb commit 11c3468
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 9 deletions.
5 changes: 5 additions & 0 deletions module/CHANGELOG-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<a href="./CHANGELOG-CN.md">简体中文</a>
</p>

## 4.2.3 (2024/8/9)

- 修复特定补全的 `menu_show_tip` 配置无效的问题
- 修复在过滤补全时,菜单渲染错误的问题

## 4.2.2 (2024/8/9)

- 当使用 `psc update *` 更新补全后,不再立即检查更新
Expand Down
5 changes: 5 additions & 0 deletions module/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<a href="./CHANGELOG.md">English</a>
</p>

## 4.2.3 (2024/8/9)

- Fix an issue where the `menu_show_tip` configuration for specific completions was invalid.
- Fix an issue where the menu was rendered incorrectly when filtering completions.

## 4.2.2 (2024/8/9)

- No longer checks for updates immediately after using `psc update *` update completion.
Expand Down
2 changes: 1 addition & 1 deletion module/PSCompletions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

RootModule = 'PSCompletions.psm1'

ModuleVersion = '4.2.2'
ModuleVersion = '4.2.3'

GUID = '00929632-527d-4dab-a5b3-21197faccd05'

Expand Down
17 changes: 12 additions & 5 deletions module/core/common/menu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,29 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod handle_list
@{ Runspace = $task; Job = $job }
}

$this.origin_filter_list = $this.filter_list = foreach ($rs in $runspaces) {

$this.filter_list = [System.Collections.Generic.List[System.Object]]@()
$this.origin_filter_list = [System.Collections.Generic.List[System.Object]]@()

foreach ($rs in $runspaces) {
$results = $rs.Runspace.EndInvoke($rs.Job)
$rs.Runspace.Dispose()
foreach ($result in $results) {
$width = $this.get_length($result.ListItemText)
if ($width -gt $max_width) { $max_width = $width }
if ($result.ToolTip.Count -gt $tip_max_height) { $tip_max_height = $result.ToolTip.Count }
@{
$result = @{
ListItemText = $result.ListItemText
CompletionText = $result.CompletionText
ToolTip = $result.ToolTip
width = $width
height = $result.ToolTip.Count
}
$this.filter_list.Add($result)
$this.origin_filter_list.Add($result)
}
}

$runspacePool.Close()
$runspacePool.Dispose()
$this.tip_max_height = $tip_max_height
Expand Down Expand Up @@ -594,7 +601,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod reset {
else {
if ($PSCompletions.current_cmd) {
$menu_show_tip = $PSCompletions.config.comp_config.$($PSCompletions.current_cmd).menu_show_tip
if ($menu_show_tip) {
if ($menu_show_tip -ne $null) {
$this.is_show_tip = $menu_show_tip -eq 1
}
else {
Expand All @@ -608,7 +615,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod reset {
}
Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module_menu {
param($filter_list, [bool]$is_menu_enhance)
$this.origin_filter_list = $this.filter_list = $filter_list
$this.filter_list = $filter_list

$lastest_encoding = [console]::OutputEncoding
[console]::OutputEncoding = $PSCompletions.encoding
Expand All @@ -629,7 +636,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module

$this.offset = 0 # 索引的偏移量,用于滚动翻页

$this.filter_completions($this.origin_filter_list)
$this.filter_completions($this.filter_list)
# 如果没有可用的选项,直接结束,触发路径补全
if (!$this.filter_list) { return }
$this.reset($true, $is_menu_enhance)
Expand Down
4 changes: 2 additions & 2 deletions module/core/init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using namespace System.Management.Automation
New-Variable -Name PSCompletions -Value @{} -Option Constant

# 模块版本
$PSCompletions.version = '4.2.2'
$PSCompletions.version = '4.2.3'
$PSCompletions.path = @{}
$PSCompletions.path.root = Split-Path $PSScriptRoot -Parent
$PSCompletions.path.completions = Join-Path $PSCompletions.path.root 'completions'
Expand Down Expand Up @@ -723,7 +723,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_powers
$info = $json.info

$menu_show_tip = $PSCompletions.config.comp_config.$($PSCompletions.current_cmd).menu_show_tip
if ($menu_show_tip) {
if ($menu_show_tip -ne $null) {
$this.is_show_tip = $menu_show_tip -eq 1
}
else {
Expand Down
12 changes: 12 additions & 0 deletions module/log.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{
"4.2.3": {
"zh-CN": [
"修复(2024/8/9)\n",
" - 修复特定补全的 <@Magenta>menu_show_tip<@Blue>配置无效的问题\n",
" - 修复在过滤补全时,菜单渲染错误的问题\n"
],
"en-US": [
"Fix(2024/8/9)\n",
" - Fix an issue where the <@Magenta>menu_show_tip<@Blue> configuration for specific completions was invalid.\n",
" - Fix an issue where the menu was rendered incorrectly when filtering completions.\n"
]
},
"4.2.2": {
"zh-CN": [
"修复(2024/8/9)\n",
Expand Down
2 changes: 1 addition & 1 deletion module/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.2
4.2.3

0 comments on commit 11c3468

Please sign in to comment.