Browse Source

Merge v2_develop

Tig Kindel 1 year ago
parent
commit
e80bd4fd39

+ 2 - 2
.github/workflows/api-docs.yml

@@ -36,14 +36,14 @@ jobs:
       
     - name: Upload artifact
       if: github.ref_name == 'main' ||  github.ref_name == 'develop'
-      uses: actions/upload-pages-artifact@v2
+      uses: actions/upload-pages-artifact@v3
       with:
         path: docfx/_site
        
     - name: Deploy to GitHub Pages
       if: github.ref_name == 'main' ||  github.ref_name == 'develop'
       id: deployment
-      uses: actions/deploy-pages@v3
+      uses: actions/deploy-pages@v4
       with:
         token: ${{ secrets.GITHUB_TOKEN }}
 

+ 1 - 1
Terminal.Gui/Application.cs

@@ -640,7 +640,7 @@ public static partial class Application {
 	/// it will be set to <see langword="false"/> if at least one iteration happened.</param>
 	public static void RunIteration (ref RunState state, ref bool firstIteration)
 	{
-		if (MainLoop.EventsPending () && MainLoop.Running) {
+		if (MainLoop.Running && MainLoop.EventsPending ()) {
 			// Notify Toplevel it's ready
 			if (firstIteration) {
 				state.Toplevel.OnReady ();

+ 0 - 1
Terminal.Gui/View/Layout/PosDim.cs

@@ -1,5 +1,4 @@
 using System;
-using static Terminal.Gui.Dim;
 
 namespace Terminal.Gui;
 

+ 9 - 1
UICatalog/Scenarios/Animation.cs

@@ -39,7 +39,15 @@ namespace UICatalog.Scenarios {
 			};
 			Win.Add (lbl2);
 
-			var dir = new DirectoryInfo (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location));
+			DirectoryInfo dir;
+
+			var assemblyLocation = Assembly.GetExecutingAssembly ().Location;
+
+			if (!string.IsNullOrEmpty (assemblyLocation)) {
+				dir = new DirectoryInfo (Path.GetDirectoryName (assemblyLocation));
+			} else {
+				dir = new DirectoryInfo (System.AppContext.BaseDirectory);
+			}
 
 			var f = new FileInfo (
 				Path.Combine (dir.FullName, "Scenarios", "Spinning_globe_dark_small.gif"));

+ 14 - 0
UICatalog/Scenarios/Dialogs.cs

@@ -115,6 +115,20 @@ namespace UICatalog.Scenarios {
 			};
 			frame.Add (styleRadioGroup);
 
+			frame.ValidatePosDim = true;
+			void Top_Loaded (object sender, EventArgs args)
+			{
+				frame.Height =
+					widthEdit.Frame.Height +
+					heightEdit.Frame.Height +
+					titleEdit.Frame.Height +
+					numButtonsEdit.Frame.Height +
+					glyphsNotWords.Frame.Height +
+					styleRadioGroup.Frame.Height;
+				Application.Top.Loaded -= Top_Loaded;
+			}
+			Application.Top.Loaded += Top_Loaded;
+
 			Win.Add (frame);
 
 			label = new Label ("Button Pressed:") {

+ 18 - 1
UICatalog/Scenarios/MessageBoxes.cs

@@ -145,7 +145,24 @@ namespace UICatalog.Scenarios {
 				Y = Pos.Top (label) + 3
 			};
 			frame.Add (ckbWrapMessage);
-		
+
+			frame.ValidatePosDim = true;
+			void Top_Loaded (object sender, EventArgs args)
+			{
+				frame.Height =
+					widthEdit.Frame.Height +
+					heightEdit.Frame.Height +
+					titleEdit.Frame.Height +
+					messageEdit.Frame.Height +
+					numButtonsEdit.Frame.Height +
+					defaultButtonEdit.Frame.Height +
+					styleRadioGroup.Frame.Height +
+					2 +
+					ckbWrapMessage.Frame.Height;
+				Application.Top.Loaded -= Top_Loaded;
+			}
+			//Application.Top.Loaded += Top_Loaded;
+
 			label = new Label ("Button Pressed:") {
 				X = Pos.Center (),
 				Y = Pos.Bottom (frame) + 4,

+ 13 - 3
UICatalog/UICatalog.cs

@@ -147,8 +147,18 @@ class UICatalogApp {
 	{
 		// Setup a file system watcher for `./.tui/`
 		_currentDirWatcher.NotifyFilter = NotifyFilters.LastWrite;
-		var f = new FileInfo (Assembly.GetExecutingAssembly ().Location);
-		string tuiDir = Path.Combine (f.Directory!.FullName, ".tui");
+
+		var assemblyLocation = Assembly.GetExecutingAssembly ().Location;
+		string tuiDir;
+
+		if (!string.IsNullOrEmpty (assemblyLocation)) {
+			var assemblyFile = new FileInfo (assemblyLocation);
+			tuiDir = Path.Combine (assemblyFile.Directory!.FullName, ".tui");
+		} else {
+			tuiDir = Path.Combine (System.AppContext.BaseDirectory, ".tui");
+		}
+
+
 
 		if (!Directory.Exists (tuiDir)) {
 			Directory.CreateDirectory (tuiDir);
@@ -158,7 +168,7 @@ class UICatalogApp {
 
 		// Setup a file system watcher for `~/.tui/`
 		_homeDirWatcher.NotifyFilter = NotifyFilters.LastWrite;
-		f = new FileInfo (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
+		var f = new FileInfo (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
 		tuiDir = Path.Combine (f.FullName, ".tui");
 
 		if (!Directory.Exists (tuiDir)) {

+ 2 - 2
UnitTests/UnitTests.csproj

@@ -25,8 +25,8 @@
     <PackageReference Include="ReportGenerator" Version="5.2.0" />
     <PackageReference Include="System.Collections" Version="4.3.0" />
     <PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="20.0.4" />
-    <PackageReference Include="xunit" Version="2.6.3" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
+    <PackageReference Include="xunit" Version="2.6.4" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>