mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
* Fixes #2516. StatusBar isn't positioned at the most bottom. * Fixes #2517. ListView EnsureSelectedItemVisible isn't working at load.
This commit is contained in:
@@ -736,14 +736,23 @@ namespace Terminal.Gui {
|
||||
/// </summary>
|
||||
public void EnsureSelectedItemVisible ()
|
||||
{
|
||||
SuperView?.LayoutSubviews ();
|
||||
if (selected < top) {
|
||||
top = Math.Max (selected, 0);
|
||||
} else if (Frame.Height > 0 && selected >= top + Frame.Height) {
|
||||
top = Math.Max (selected - Frame.Height + 1, 0);
|
||||
if (SuperView?.IsInitialized == true) {
|
||||
if (selected < top) {
|
||||
top = Math.Max (selected, 0);
|
||||
} else if (Frame.Height > 0 && selected >= top + Frame.Height) {
|
||||
top = Math.Max (selected - Frame.Height + 1, 0);
|
||||
}
|
||||
LayoutStarted -= ListView_LayoutStarted;
|
||||
} else {
|
||||
LayoutStarted += ListView_LayoutStarted;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListView_LayoutStarted (object sender, LayoutEventArgs e)
|
||||
{
|
||||
EnsureSelectedItemVisible ();
|
||||
}
|
||||
|
||||
///<inheritdoc/>
|
||||
public override void PositionCursor ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user