mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Adjust the top considering the selected item and the frame height.
This commit is contained in:
@@ -601,10 +601,12 @@ namespace Terminal.Gui {
|
||||
/// <returns></returns>
|
||||
public virtual bool MoveEnd ()
|
||||
{
|
||||
if (source.Count > 0 && selected != source.Count - 1) {
|
||||
if (source?.Count > 0 && selected != source.Count - 1) {
|
||||
selected = source.Count - 1;
|
||||
if (top + selected > Frame.Height - 1) {
|
||||
top = selected;
|
||||
top = selected < Frame.Height - 1
|
||||
? Math.Max (Frame.Height - selected + 1, 0)
|
||||
: Math.Max (selected - Frame.Height + 1, 0);
|
||||
}
|
||||
OnSelectedChanged ();
|
||||
SetNeedsDisplay ();
|
||||
|
||||
@@ -300,16 +300,16 @@ namespace Terminal.Gui.ViewTests {
|
||||
Assert.Equal (19, lv.SelectedItem);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌──────────┐
|
||||
│Line10 │
|
||||
│Line11 │
|
||||
│Line12 │
|
||||
│Line13 │
|
||||
│Line14 │
|
||||
│Line15 │
|
||||
│Line16 │
|
||||
│Line17 │
|
||||
│Line18 │
|
||||
│Line19 │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└──────────┘", output);
|
||||
|
||||
Assert.True (lv.ScrollUp (20));
|
||||
|
||||
Reference in New Issue
Block a user