Skip to content

Commit a2afaec

Browse files
committed
Update Terminal.Gui to beta.149 and adapt to API changes
Updated Terminal.Gui to 2.0.0-beta.149 and refactored code to use new PaddingView and Adornment APIs in Header.cs and OutGridViewWindow.cs. Added launchSettings.json with multiple PowerShell launch profiles for easier debugging and testing.
1 parent eeebd7e commit a2afaec

4 files changed

Lines changed: 52 additions & 5 deletions

File tree

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<PackageVersion Include="Microsoft.PowerShell.SDK" Version="7.5.4" />
44
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
55
<PackageVersion Include="System.Management.Automation" Version="7.5.4" />
6-
<PackageVersion Include="Terminal.Gui" Version="2.0.0-beta.81" />
6+
<PackageVersion Include="Terminal.Gui" Version="2.0.0-beta.149" />
77
</ItemGroup>
88
</Project>

src/Microsoft.PowerShell.ConsoleGuiTools/Header.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override void EndInit()
2727

2828

2929
// We are a subview of the ListView.Padding.
30-
if (SuperView is Padding padding) padding.Parent?.ViewportChanged += ListViewOnViewportChanged;
30+
if (SuperView is PaddingView padding) padding.Adornment?.Parent?.ViewportChanged += ListViewOnViewportChanged;
3131

3232
return;
3333

@@ -40,7 +40,7 @@ void ListViewOnViewportChanged(object? sender, DrawEventArgs e)
4040

4141
protected override void OnSubViewLayout(LayoutEventArgs args)
4242
{
43-
if (SuperView is Padding { Parent: ListView listView })
43+
if (SuperView is PaddingView { Adornment.Parent: ListView listView })
4444
SetContentSize(GetContentSize() with { Width = listView.GetContentSize().Width });
4545

4646
base.OnSubViewLayout(args);

src/Microsoft.PowerShell.ConsoleGuiTools/OutGridViewWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ void AddHeader()
368368
};
369369

370370

371-
_listView.Padding!.Thickness = _listView.Padding.Thickness with { Top = 1 };
372-
_listView!.Padding!.Add(_header);
371+
_listView.Padding.Thickness = _listView.Padding.Thickness with { Top = 1 };
372+
_listView.Padding.GetOrCreateView().Add (_header);
373373
_listView.VerticalScrollBar.Y = 1;
374374

375375
_header?.SetHeaders(_dataTable?.DataColumns.Select(c => c.Label).ToList(), _naturalColumnWidths);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"profiles": {
3+
"OCGV": {
4+
"commandName": "Executable",
5+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
6+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; Get-Process | Out-ConsoleGridView -Debug }\"",
7+
"workingDirectory": "$(TargetDir)"
8+
},
9+
"OCGV -Filter": {
10+
"commandName": "Executable",
11+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
12+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; Get-Process | Select-Object ProcessName, Id, CPU | Out-ConsoleGridView -Debug -Filter com }\"",
13+
"workingDirectory": "$(TargetDir)"
14+
},
15+
"OCGV -MinUi": {
16+
"commandName": "Executable",
17+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
18+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; Get-Process | Out-ConsoleGridView -MinUi }\"",
19+
"workingDirectory": "$(TargetDir)"
20+
},
21+
"OCGV -AllProperties": {
22+
"commandName": "Executable",
23+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
24+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; Get-Process | Out-ConsoleGridView -AllProperties }\"",
25+
"workingDirectory": "$(TargetDir)"
26+
},
27+
"OCGV Select-Object": {
28+
"commandName": "Executable",
29+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
30+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; Get-Process | Select-Object ProcessName, Id, Handles, NPM, PM, WS, CPU | Out-ConsoleGridView }\"",
31+
"workingDirectory": "$(TargetDir)"
32+
},
33+
"gci | OCGV": {
34+
"commandName": "Executable",
35+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
36+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; gci | Out-ConsoleGridView -OutputMode: Single }\"",
37+
"workingDirectory": "$(TargetDir)"
38+
},
39+
"SHOT": {
40+
"commandName": "Executable",
41+
"executablePath": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
42+
"commandLineArgs": "-NoProfile -NoLogo -NoExit -Command \"& { Import-Module '$(TargetPath)'; Get-Process | Show-ObjectTree }\"",
43+
"workingDirectory": "$(TargetDir)"
44+
}
45+
}
46+
}
47+

0 commit comments

Comments
 (0)