Skip to content

Commit 65df6c7

Browse files
committed
Simplify term start to avoid multiple ready events
1 parent 9ea8f19 commit 65df6c7

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

EasyWindowsTerminalControl.WinUI/EasyWindowsTerminalControl.WinUI.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
77
<UseWinUI>true</UseWinUI>
88
<Platforms>AnyCPU;x64</Platforms>
9-
<Version>1.0.17-beta.1</Version>
9+
<Version>1.0.18-beta.1</Version>
1010
<Description>High performance WinUI3 native terminal/shell control. For WPF version see EasyWindowsTerminalControl alt package. It features full 24-bit color support with ANSI/VT escape sequences (and colors), hardware / GPU accelerated rendering, mouse support, and true console interaction. Support for command shells and key sequences, user interaction and programatic control. See GH for more details.</Description>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<Authors>MitchCapper</Authors>
@@ -39,7 +39,7 @@
3939
</ItemGroup>
4040
<ItemGroup>
4141
<PackageReference Include="CI.Microsoft.Windows.Console.ConPTY" Version="1.22.250314001" />
42-
<PackageReference Include="CI.Microsoft.Terminal.WinUI3.Unofficial" Version="1.0.17-beta.1" />
42+
<PackageReference Include="CI.Microsoft.Terminal.WinUI3.Unofficial" Version="1.0.18-beta.1" />
4343
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
4444
<PrivateAssets>all</PrivateAssets>
4545
</PackageReference>
@@ -49,3 +49,5 @@
4949

5050

5151

52+
53+

EasyWindowsTerminalControl/EasyTerminalControl.cs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -193,30 +193,24 @@ private void Term_TermReady(object sender, EventArgs e) {
193193
/// </summary>
194194
/// <param name="useTerm">Optional term to use, note if useTerm.TermProcIsStarted this function will not do verry much</param>
195195
/// <param name="disposeOld">True if the old term should be killed off</param>
196-
public async Task RestartTerm(TermPTY useTerm = null, bool disposeOld=true){
196+
public async Task RestartTerm(TermPTY useTerm = null, bool disposeOld = true) {
197197
var oldTerm = ConPTYTerm;
198198
DisconnectConPTYTerm();
199-
ConPTYTerm = useTerm ?? new TermPTY();
200-
if (disposeOld){
201-
try{
202-
oldTerm?.CloseStdinToApp();
203-
}catch{ }
204-
try{
205-
oldTerm?.StopExternalTermOnly();
206-
}catch{ }
199+
if (disposeOld) {
200+
try {
201+
oldTerm?.CloseStdinToApp();
202+
} catch { }
203+
try {
204+
oldTerm?.StopExternalTermOnly();
205+
} catch { }
207206
}
208-
await TermInit();
207+
208+
ConPTYTerm = useTerm ?? new TermPTY(); //setting the term to a new value will automatically initalize everyhting
209209
}
210210
private void StartTerm(int column_width, int row_height) {
211-
if (ConPTYTerm == null)
211+
if (ConPTYTerm?.TermProcIsStarted != false)
212212
return;
213213

214-
if (ConPTYTerm.TermProcIsStarted) {
215-
ConPTYTerm.Resize(column_width, row_height);
216-
Term_TermReady(ConPTYTerm, null);
217-
return;
218-
}
219-
ConPTYTerm.TermReady += Term_TermReady;
220214
MainThreadRun(() => {
221215
var cmd = StartupCommandLine;//thread safety for dp
222216
var term = ConPTYTerm;

EasyWindowsTerminalControl/EasyWindowsTerminalControl.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<PlatformTarget>x64</PlatformTarget>
66
<Platforms>x64</Platforms>
77
<UseWpf>true</UseWpf>
8-
<Version>1.0.35</Version>
8+
<Version>1.0.36</Version>
99
<PackageReadmeFile>README.md</PackageReadmeFile>
1010
<PackageOutputPath>../Publish</PackageOutputPath>
1111
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -34,3 +34,4 @@
3434
</Project>
3535

3636

37+

Microsoft.Terminal.WinUI3/Microsoft.Terminal.WinUI3.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<BeforePack>CollectNativePackContents</BeforePack>
1111
<Authors>MitchCapper</Authors>
1212
<PackageProjectUrl>https://github.com/MitchCapper/EasyWindowsTerminalControl</PackageProjectUrl>
13-
<Version>1.0.17-beta.1</Version>
13+
<Version>1.0.18-beta.1</Version>
1414
<Description>This is an unofficial WinUI3 recreation of the official Microsoft.Terminal.WPF package. Highly recommend using this with the "EasyWindowsTerminalControl.WinUI".</Description>
1515
<PackageOutputPath>../Publish</PackageOutputPath>
1616
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -98,3 +98,4 @@
9898
</Project>
9999

100100

101+

TermExample.WinUI/TermExample.WinUI.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<ItemGroup>
3838
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
3939
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250310001" />
40-
<PackageReference Include="EasyWindowsTerminalControl.WinUI" Version="1.0.17-beta.1" />
40+
<PackageReference Include="EasyWindowsTerminalControl.WinUI" Version="1.0.18-beta.1" />
4141

4242
</ItemGroup>
4343
<ItemGroup>
@@ -74,3 +74,4 @@
7474
</Project>
7575

7676

77+

0 commit comments

Comments
 (0)