Removes unnecessary RightOffset and BottomOffset properties.

This commit is contained in:
BDisp
2024-05-29 16:57:44 +01:00
parent 933b0b5ff8
commit 68ba0db9c4
5 changed files with 17 additions and 186 deletions

View File

@@ -794,30 +794,6 @@ This is a test
textView.SetNeedsDisplay ();
};
scrollBar.VisibleChanged += (s, e) =>
{
if (scrollBar.Visible && textView.RightOffset == 0)
{
textView.RightOffset = 1;
}
else if (!scrollBar.Visible && textView.RightOffset == 1)
{
textView.RightOffset = 0;
}
};
scrollBar.OtherScrollBarView.VisibleChanged += (s, e) =>
{
if (scrollBar.OtherScrollBarView.Visible && textView.BottomOffset == 0)
{
textView.BottomOffset = 1;
}
else if (!scrollBar.OtherScrollBarView.Visible && textView.BottomOffset == 1)
{
textView.BottomOffset = 0;
}
};
textView.LayoutComplete += (s, e) =>
{
scrollBar.Size = textView.Lines;

View File

@@ -107,38 +107,6 @@ public class TextViewTests
Application.Run (top);
}
[Fact]
[TextViewTestsAutoInitShutdown]
public void BottomOffset_Sets_To_Zero_Adjust_TopRow ()
{
var text = "";
for (var i = 0; i < 12; i++)
{
text += $"This is the line {i}\n";
}
var tv = new TextView { Width = 10, Height = 10, BottomOffset = 1 };
tv.Text = text;
tv.NewKeyDownEvent (Key.End.WithCtrl);
Assert.Equal (4, tv.TopRow);
Assert.Equal (1, tv.BottomOffset);
tv.BottomOffset = 0;
Assert.Equal (3, tv.TopRow);
Assert.Equal (0, tv.BottomOffset);
tv.BottomOffset = 2;
Assert.Equal (5, tv.TopRow);
Assert.Equal (2, tv.BottomOffset);
tv.BottomOffset = 0;
Assert.Equal (3, tv.TopRow);
Assert.Equal (0, tv.BottomOffset);
}
[Fact]
[TextViewTestsAutoInitShutdown]
public void CanFocus_False_Wont_Focus_With_Mouse ()
@@ -6943,38 +6911,6 @@ This is the second line.
Assert.Equal (textToReplace, tv.Text);
}
[Fact]
[TextViewTestsAutoInitShutdown]
public void RightOffset_Sets_To_Zero_Adjust_leftColumn ()
{
var text = "";
for (var i = 0; i < 12; i++)
{
text += $"{i.ToString () [^1]}";
}
var tv = new TextView { Width = 10, Height = 10, RightOffset = 1 };
tv.Text = text;
tv.NewKeyDownEvent (Key.End);
Assert.Equal (4, tv.LeftColumn);
Assert.Equal (1, tv.RightOffset);
tv.RightOffset = 0;
Assert.Equal (3, tv.LeftColumn);
Assert.Equal (0, tv.RightOffset);
tv.RightOffset = 2;
Assert.Equal (5, tv.LeftColumn);
Assert.Equal (2, tv.RightOffset);
tv.RightOffset = 0;
Assert.Equal (3, tv.LeftColumn);
Assert.Equal (0, tv.RightOffset);
}
[Fact]
[AutoInitShutdown]
public void ScrollDownTillCaretOffscreen_ThenType ()