Tig 1 рік тому
батько
коміт
c372c065ac

+ 4 - 0
Terminal.Gui/Views/TextField.cs

@@ -1227,6 +1227,10 @@ public class TextField : View
             return;
         }
 
+        // TODO: This is a lame prototype proving it should be easy for TextField to 
+        // TODO: support Width = Dim.Auto (DimAutoStyle: Content).
+        //SetContentSize(new (TextModel.DisplaySize (_text).size, 1));
+
         int offB = OffSetBackground ();
         bool need = NeedsDisplay || !Used;
 

+ 9 - 0
Terminal.Gui/Views/TextView.cs

@@ -680,6 +680,14 @@ internal class TextModel
         return (size, len);
     }
 
+    internal Size GetDisplaySize ()
+    {
+        Size size = Size.Empty;
+
+
+        return size;
+    }
+
     internal (Point current, bool found) FindNextText (
         string text,
         out bool gaveFullTurn,
@@ -3566,6 +3574,7 @@ public class TextView : View
 
         ProcessInheritsPreviousColorScheme (CurrentRow, CurrentColumn);
         ProcessAutocomplete ();
+
     }
 
     /// <inheritdoc/>

+ 3 - 1
UICatalog/Scenarios/Mouse.cs

@@ -25,7 +25,9 @@ public class Mouse : Scenario
             Y = 0,
             BorderStyle = LineStyle.Single,
             Type = SliderType.Multiple,
-            Orientation = Orientation.Vertical
+            Orientation = Orientation.Vertical,
+            UseMinimumSize = true,
+            MinimumInnerSpacing = 0
         };
 
         filterSlider.Options = Enum.GetValues (typeof (MouseFlags))

+ 4 - 4
UICatalog/Scenarios/Text.cs

@@ -28,9 +28,6 @@ public class Text : Scenario
             X = Pos.Right (label) + 1,
             Y = 0,
             Width = Dim.Percent (50) - 1,
-
-            // Height will be replaced with 1
-            Height = 2,
             Text = "TextField with test text. Unicode shouldn't 𝔹Aℝ𝔽!"
         };
 
@@ -66,7 +63,10 @@ public class Text : Scenario
 
         var textView = new TextView
         {
-            X = Pos.Right (label) + 1, Y = Pos.Bottom (textField) + 1, Width = Dim.Percent (50) - 1, Height = Dim.Percent (30)
+            X = Pos.Right (label) + 1, 
+            Y = Pos.Top (label), 
+            Width = Dim.Percent (50) - 1, 
+            Height = Dim.Percent (20)
         };
         textView.Text = "TextView with some more test text. Unicode shouldn't 𝔹Aℝ𝔽!";
         textView.DrawContent += TextView_DrawContent;