Fixed a focused issue.

This commit is contained in:
BDisp
2020-07-27 23:46:23 +01:00
parent b7901acd2b
commit cd2faf5fbd
2 changed files with 5 additions and 3 deletions

View File

@@ -748,6 +748,9 @@ namespace Terminal.Gui {
view.SetNeedsDisplay ();
}
OnRemoved (view);
if (focused == view) {
focused = null;
}
}
void PerformActionForSubview (View subview, Action<View> action)
@@ -1882,9 +1885,6 @@ namespace Terminal.Gui {
Remove (subview);
subview.Dispose ();
}
if (Application.Top.focused == this) {
Application.Top.focused = null;
}
base.Dispose (disposing);
}

View File

@@ -1019,11 +1019,13 @@ namespace Terminal.Gui {
LastFocused = lastFocused;
lastFocused = null;
if (LastFocused != null) {
CanFocus = false;
if (!reopen) {
selected = -1;
}
LastFocused.SuperView?.SetFocus (LastFocused);
} else {
CanFocus = true;
SuperView.SetFocus (this);
PositionCursor ();
}