From 11f29d45ea81510436131decbaf4339f751f287d Mon Sep 17 00:00:00 2001 From: BDisp Date: Sun, 23 Jan 2022 23:37:46 +0000 Subject: [PATCH] A unit test to prove the 4df5897. --- UnitTests/TextViewTests.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/UnitTests/TextViewTests.cs b/UnitTests/TextViewTests.cs index 8852d0b70..031b137f6 100644 --- a/UnitTests/TextViewTests.cs +++ b/UnitTests/TextViewTests.cs @@ -2262,5 +2262,26 @@ line. } } } + + [Fact] + public void LeftColumn_Add_One_If_Text_Length_Is_Equal_To_Width () + { + var tv = new TextView () { + Width = 10, + Text = "1234567890" + }; + + Assert.Equal (Point.Empty, tv.CursorPosition); + Assert.Equal (0, tv.LeftColumn); + + tv.CursorPosition = new Point (9, 0); + Assert.Equal (new Point (9, 0), tv.CursorPosition); + Assert.Equal (0, tv.LeftColumn); + + Assert.True (tv.ProcessKey (new KeyEvent (Key.CursorRight, new KeyModifiers ()))); + tv.CursorPosition = new Point (10, 0); + Assert.Equal (new Point (10, 0), tv.CursorPosition); + Assert.Equal (1, tv.LeftColumn); + } } }