From 137417f768d31bceb19ca11e2a2c40b2ef7b50ef Mon Sep 17 00:00:00 2001 From: miguel Date: Sat, 1 Dec 2018 12:37:14 -0500 Subject: [PATCH] [TextField] update point to 0 or the lenght-1 on changes, fixes #150 --- Example/demo.cs | 1 + Terminal.Gui/Views/TextField.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Example/demo.cs b/Example/demo.cs index d36621011..7b86e62ea 100755 --- a/Example/demo.cs +++ b/Example/demo.cs @@ -106,6 +106,7 @@ static class Demo { Y = Pos.Top (login), Width = 40 }; + var passText = new TextField ("") { Secret = true, X = Pos.Left (loginText), diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index 86606676e..d43b1e72c 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -95,7 +95,7 @@ namespace Terminal.Gui { set { text = TextModel.ToRunes (value); if (point > text.Count) - point = text.Count; + point = Math.Max (text.Count-1, 0); // FIXME: this needs to be updated to use Rune.ColumnWidth first = point > Frame.Width ? point - Frame.Width : 0;