mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 00:07:58 +01:00
Fixed latent bug in ScrollBarView
This commit is contained in:
@@ -273,7 +273,10 @@ public class ListView : View
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the item that is displayed at the top of the <see cref="ListView"/>.</summary>
|
||||
/// <summary>Gets or sets the index of the item that will appear at the top of the <see cref="View.Viewport"/>.</summary>
|
||||
/// <remarks>
|
||||
/// This a helper property for accessing <c>listView.Viewport.Y</c>.
|
||||
/// </remarks>
|
||||
/// <value>The top item.</value>
|
||||
public int TopItem
|
||||
{
|
||||
@@ -285,13 +288,7 @@ public class ListView : View
|
||||
return;
|
||||
}
|
||||
|
||||
if (value < 0 || (_source.Count > 0 && value >= _source.Count))
|
||||
{
|
||||
throw new ArgumentException ("value");
|
||||
}
|
||||
|
||||
Viewport = Viewport with { Y = value };
|
||||
SetNeedsDisplay ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -204,6 +204,11 @@ public class ScrollBarView : View
|
||||
get => _position;
|
||||
set
|
||||
{
|
||||
if (_position == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_position = value;
|
||||
|
||||
if (IsInitialized)
|
||||
@@ -900,6 +905,10 @@ public class ScrollBarView : View
|
||||
// Helper to assist Initialized event handler
|
||||
private void SetPosition (int newPosition)
|
||||
{
|
||||
if (newPosition < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (CanScroll (newPosition - _position, out int max, _vertical))
|
||||
{
|
||||
if (max == newPosition - _position)
|
||||
|
||||
Reference in New Issue
Block a user