Skip to content

Commit 0fc29ad

Browse files
committed
Closes gui-cs#973. ScrollView and TextField fixes.
1 parent 1e656b3 commit 0fc29ad

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎FSharpExample/Program.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Box10x (x: int, y: int) =
2727
raise (NotImplementedException())
2828

2929
override this.Redraw (_: Rect) =
30-
Application.Driver.SetAttribute Application.Current.ColorScheme.Focus
30+
Application.Driver.SetAttribute this.ColorScheme.Focus
3131
do
3232
let mutable y = 0
3333
while y < h do
@@ -47,7 +47,7 @@ type Filler (rect: Rect) =
4747
new Filler ()
4848

4949
override this.Redraw (_: Rect) =
50-
Application.Driver.SetAttribute Application.Current.ColorScheme.Focus
50+
Application.Driver.SetAttribute this.ColorScheme.Focus
5151
let mutable f = this.Frame
5252
do
5353
let mutable y = 0

‎Terminal.Gui/Views/TextField.cs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public class TextField : View {
4848
/// <param name="text">Initial text contents.</param>
4949
public TextField (string text) : this (ustring.Make (text))
5050
{
51-
Height = 1;
51+
Initialize ();
5252
}
5353

5454
/// <summary>
5555
/// Initializes a new instance of the <see cref="TextField"/> class using <see cref="LayoutStyle.Computed"/> positioning.
5656
/// </summary>
57-
public TextField () : this (string.Empty) { }
57+
public TextField () : this (string.Empty) { Initialize (); }
5858

5959
/// <summary>
6060
/// Initializes a new instance of the <see cref="TextField"/> class using <see cref="LayoutStyle.Computed"/> positioning.
@@ -80,6 +80,8 @@ public TextField (int x, int y, int w, ustring text) : base (new Rect (x, y, w,
8080

8181
void Initialize (ustring text, int w)
8282
{
83+
Initialize ();
84+
8385
if (text == null)
8486
text = "";
8587

@@ -91,6 +93,11 @@ void Initialize (ustring text, int w)
9193
WantMousePositionReports = true;
9294
}
9395

96+
void Initialize ()
97+
{
98+
Height = 1;
99+
}
100+
94101
///<inheritdoc/>
95102
public override bool OnLeave (View view)
96103
{

0 commit comments

Comments
 (0)