mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixing some bugs.
This commit is contained in:
@@ -741,7 +741,7 @@ namespace Terminal.Gui {
|
||||
public void SetChildNeedsDisplay ()
|
||||
{
|
||||
ChildNeedsDisplay = true;
|
||||
if (container != null && !container.ChildNeedsDisplay)
|
||||
if (container != null)
|
||||
container.SetChildNeedsDisplay ();
|
||||
}
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace Terminal.Gui {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Host.HasFocus) {
|
||||
if (Host != null && !Host.HasFocus) {
|
||||
Host.SetFocus ();
|
||||
}
|
||||
|
||||
@@ -537,7 +537,8 @@ namespace Terminal.Gui {
|
||||
internal bool CanScroll (int n, out int max, bool isVertical = false)
|
||||
{
|
||||
if (Host == null) {
|
||||
throw new ArgumentNullException ("The host can't be null.");
|
||||
max = 0;
|
||||
return false;
|
||||
}
|
||||
var s = isVertical ?
|
||||
(KeepContentAlwaysInViewport ? Host.Bounds.Height + (showBothScrollIndicator ? -2 : -1) : 0) :
|
||||
|
||||
@@ -118,11 +118,13 @@ namespace Terminal.Gui {
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Scrolling_With_Default_Constructor_Throws_ArgumentNullException ()
|
||||
public void Scrolling_With_Default_Constructor_Do_Not_Scroll ()
|
||||
{
|
||||
var sbv = new ScrollBarView ();
|
||||
|
||||
Assert.Throws<ArgumentNullException> ("The host can't be null.", () => sbv.Position = 1);
|
||||
var sbv = new ScrollBarView {
|
||||
Position = 1
|
||||
};
|
||||
Assert.NotEqual (1, sbv.Position);
|
||||
Assert.Equal (0, sbv.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user