Tig 1 год назад
Родитель
Сommit
d21489cbf8
2 измененных файлов с 1 добавлено и 18 удалено
  1. 1 12
      Terminal.Gui/Views/TextView.cs
  2. 0 6
      UnitTests/Views/TextViewTests.cs

+ 1 - 12
Terminal.Gui/Views/TextView.cs

@@ -2699,13 +2699,8 @@ public class TextView : View
                 CurrentRow = 0;
                 _savedHeight = Height;
 
-                //var prevLayoutStyle = LayoutStyle;
-                //if (LayoutStyle == LayoutStyle.Computed) {
-                //	LayoutStyle = LayoutStyle.Absolute;
-                //}
-                Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize
+                Height = Dim.Auto (DimAutoStyle.Text, minimumContentDim: 1);
 
-                //LayoutStyle = prevLayoutStyle;
                 if (!IsInitialized)
                 {
                     _model.LoadString (Text);
@@ -2715,13 +2710,7 @@ public class TextView : View
             }
             else if (_multiline && _savedHeight is { })
             {
-                //var lyout = LayoutStyle;
-                //if (LayoutStyle == LayoutStyle.Computed) {
-                //	LayoutStyle = LayoutStyle.Absolute;
-                //}
                 Height = _savedHeight;
-
-                //LayoutStyle = lyout;
                 SetNeedsDisplay ();
             }
         }

+ 0 - 6
UnitTests/Views/TextViewTests.cs

@@ -6897,8 +6897,6 @@ This is the second line.
         Assert.True (_textView.AllowsReturn);
         Assert.Equal (4, _textView.TabWidth);
         Assert.True (_textView.AllowsTab);
-        Assert.Equal ("Absolute(30)", _textView.Width.ToString ());
-        Assert.Equal ("Absolute(10)", _textView.Height.ToString ());
         Assert.False (_textView.WordWrap);
 
         _textView.WordWrap = true;
@@ -6908,8 +6906,6 @@ This is the second line.
         Assert.False (_textView.AllowsReturn);
         Assert.Equal (0, _textView.TabWidth);
         Assert.False (_textView.AllowsTab);
-        Assert.Equal ("Absolute(30)", _textView.Width.ToString ());
-        Assert.Equal ("Absolute(1)", _textView.Height.ToString ());
         Assert.False (_textView.WordWrap);
 
         _textView.WordWrap = true;
@@ -6919,8 +6915,6 @@ This is the second line.
         Assert.True (_textView.AllowsReturn);
         Assert.Equal (4, _textView.TabWidth);
         Assert.True (_textView.AllowsTab);
-        Assert.Equal ("Absolute(30)", _textView.Width.ToString ());
-        Assert.Equal ("Absolute(10)", _textView.Height.ToString ());
         Assert.False (_textView.WordWrap);
     }