Browse Source

Merge branch 'develop' into fixes_2205_fakeclipboard

Charlie Kindel 2 years ago
parent
commit
d5e55a2f7f

+ 5 - 2
Terminal.Gui/Views/ContextMenu.cs

@@ -52,7 +52,10 @@ namespace Terminal.Gui {
 		public ContextMenu (int x, int y, MenuBarItem menuItems)
 		{
 			if (IsShow) {
-				Hide ();
+				if (menuBar.SuperView != null) {
+					Hide ();
+				}
+				IsShow = false;
 			}
 			MenuItems = menuItems;
 			Position = new Point (x, y);
@@ -126,7 +129,7 @@ namespace Terminal.Gui {
 			} else if (ForceMinimumPosToZero && position.Y < 0) {
 				position.Y = 0;
 			}
-			
+
 			menuBar = new MenuBar (new [] { MenuItems }) {
 				X = position.X,
 				Y = position.Y,

+ 4 - 1
Terminal.Gui/Windows/MessageBox.cs

@@ -238,7 +238,10 @@ namespace Terminal.Gui {
 		static int QueryFull (bool useErrorColors, int width, int height, ustring title, ustring message,
 			int defaultButton = 0, Border border = null, params ustring [] buttons)
 		{
-			const int defaultWidth = 50;
+			int defaultWidth = 50;
+			if (defaultWidth > Application.Driver.Cols / 2) {
+				defaultWidth = (int)(Application.Driver.Cols * 0.60f);
+			}
 			int maxWidthLine = TextFormatter.MaxWidthLine (message);
 			if (maxWidthLine > Application.Driver.Cols) {
 				maxWidthLine = Application.Driver.Cols;

+ 5 - 5
UnitTests/MessageBoxTests.cs

@@ -30,11 +30,11 @@ namespace Terminal.Gui.Views {
 				} else if (iterations == 1) {
 					Application.Top.Redraw (Application.Top.Bounds);
 					TestHelpers.AssertDriverContentsWithFrameAre (@"
-               ┌ Title ─────────────────────────────────────────┐
-                                   Message 
-               
-               
-               └────────────────────────────────────────────────┘
+                ┌ Title ───────────────────────────────────────┐
+                                   Message                    │
+               
+               
+                └──────────────────────────────────────────────┘
 ", output);
 
 					Application.RequestStop ();

+ 1 - 1
UnitTests/UnitTests.csproj

@@ -22,7 +22,7 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
-    <PackageReference Include="ReportGenerator" Version="5.1.10" />
+    <PackageReference Include="ReportGenerator" Version="5.1.11" />
     <PackageReference Include="System.Collections" Version="4.3.0" />
     <PackageReference Include="xunit" Version="2.4.2" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">