From 9c74f99d560967837e1a80c69842a4025579143f Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 4 Jan 2023 17:23:34 -0700 Subject: [PATCH 1/5] Release v1.9.0 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2d3c808bb..d62088a11 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ A toolkit for building rich console apps for .NET, .NET Core, and Mono that work ![Sample app](docfx/images/sample.gif) - ## Quick Start Paste these commands into your favorite terminal on Windows, Mac, or Linux. This will install the [Terminal.Gui.Templates](https://github.com/gui-cs/Terminal.Gui.templates), create a new "Hello World" TUI app, and run it. From b4db4eef3ca5a42d61f33da1b42b32dc773f88f2 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Wed, 4 Jan 2023 17:24:03 -0700 Subject: [PATCH 2/5] Release v1.9.0 --- Terminal.Gui/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Terminal.Gui/README.md b/Terminal.Gui/README.md index d459d3ac0..37a026fd7 100644 --- a/Terminal.Gui/README.md +++ b/Terminal.Gui/README.md @@ -68,7 +68,6 @@ The PR title should be of the form "Release v2.3.4" git checkout develop git pull upstream develop git checkout -b v_2_3_4 -git merge develop git add . git commit -m "Release v2.3.4" git push From 3093e03ddb3887c054f9d6823a702532fa41b684 Mon Sep 17 00:00:00 2001 From: Tig Date: Wed, 4 Jan 2023 18:12:31 -0700 Subject: [PATCH 3/5] Merge v1.9.0 develop to main (#2272) * Release v1.9.0 * Release v1.9.0 --- README.md | 1 - Terminal.Gui/README.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 2d3c808bb..d62088a11 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ A toolkit for building rich console apps for .NET, .NET Core, and Mono that work ![Sample app](docfx/images/sample.gif) - ## Quick Start Paste these commands into your favorite terminal on Windows, Mac, or Linux. This will install the [Terminal.Gui.Templates](https://github.com/gui-cs/Terminal.Gui.templates), create a new "Hello World" TUI app, and run it. diff --git a/Terminal.Gui/README.md b/Terminal.Gui/README.md index d459d3ac0..37a026fd7 100644 --- a/Terminal.Gui/README.md +++ b/Terminal.Gui/README.md @@ -68,7 +68,6 @@ The PR title should be of the form "Release v2.3.4" git checkout develop git pull upstream develop git checkout -b v_2_3_4 -git merge develop git add . git commit -m "Release v2.3.4" git push From 25ada9c7b79e17faea851a1c1c7204953f487537 Mon Sep 17 00:00:00 2001 From: Tig Date: Wed, 4 Jan 2023 18:14:03 -0700 Subject: [PATCH 4/5] Merge v1.9.0 develop to main (#2272) (#2273) * Release v1.9.0 * Release v1.9.0 From eea6bf2ef88ecd477d6426a4fac9a7b668957675 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 5 Jan 2023 15:31:36 +0000 Subject: [PATCH 5/5] Fixes #2277. Changing TextField.Text does not clear text selection. --- Terminal.Gui/Views/TextField.cs | 1 + UnitTests/TextFieldTests.cs | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index 8e843b22b..14fc56394 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -298,6 +298,7 @@ namespace Terminal.Gui { } return; } + ClearAllSelection (); text = TextModel.ToRunes (newText.NewText); if (!Secret && !historyText.IsFromHistory) { diff --git a/UnitTests/TextFieldTests.cs b/UnitTests/TextFieldTests.cs index cc3559848..a931f72e0 100644 --- a/UnitTests/TextFieldTests.cs +++ b/UnitTests/TextFieldTests.cs @@ -1296,5 +1296,32 @@ namespace Terminal.Gui.Views { Assert.Equal ($"{text}A", tf.Text); Assert.True (tf.IsDirty); } + + [InlineData ("a")] // Lower than selection + [InlineData ("aaaaaaaaaaa")] // Greater than selection + [InlineData ("aaaa")] // Equal than selection + [Theory] + public void TestSetTextAndMoveCursorToEnd_WhenExistingSelection (string newText) + { + var tf = new TextField (); + tf.Text = "fish"; + tf.CursorPosition = tf.Text.Length; + + tf.ProcessKey (new KeyEvent (Key.CursorLeft, new KeyModifiers ())); + + tf.ProcessKey (new KeyEvent (Key.CursorLeft | Key.ShiftMask, new KeyModifiers { Shift = true })); + tf.ProcessKey (new KeyEvent (Key.CursorLeft | Key.ShiftMask, new KeyModifiers { Shift = true })); + + Assert.Equal (1, tf.CursorPosition); + Assert.Equal (2, tf.SelectedLength); + Assert.Equal ("is", tf.SelectedText); + + tf.Text = newText; + tf.CursorPosition = tf.Text.Length; + + Assert.Equal (newText.Length, tf.CursorPosition); + Assert.Equal (0, tf.SelectedLength); + Assert.Null (tf.SelectedText); + } } } \ No newline at end of file