Fixes #698 StatusBar position on resizing. (#699)

* Fixes #698 StatusBar position on resizing.

* Changed to LayoutComplete in StatusBar.
This commit is contained in:
BDisp
2020-06-16 15:06:53 +01:00
committed by GitHub
parent bcc341a240
commit a6a3c99703
2 changed files with 23 additions and 25 deletions

View File

@@ -269,31 +269,28 @@ namespace Terminal.Gui {
internal void PositionToplevels ()
{
if (this != Application.Top) {
EnsureVisibleBounds (this, Frame.X, Frame.Y, out int nx, out int ny);
if ((nx != Frame.X || ny != Frame.Y) && LayoutStyle != LayoutStyle.Computed) {
X = nx;
Y = ny;
foreach (var top in Subviews) {
if (top is Toplevel) {
PositionToplevel ((Toplevel)top);
}
} else {
foreach (var top in Subviews) {
if (top is Toplevel) {
EnsureVisibleBounds ((Toplevel)top, top.Frame.X, top.Frame.Y, out int nx, out int ny);
if ((nx != top.Frame.X || ny != top.Frame.Y) && top.LayoutStyle != LayoutStyle.Computed) {
top.X = nx;
top.Y = ny;
}
if (StatusBar != null) {
if (ny + top.Frame.Height > Driver.Rows - 1) {
if (top.Height is Dim.DimFill)
top.Height = Dim.Fill () - 1;
}
if (StatusBar.Frame.Y != Driver.Rows - 1) {
StatusBar.Y = Driver.Rows - 1;
SetNeedsDisplay ();
}
}
}
}
}
private void PositionToplevel (Toplevel top)
{
EnsureVisibleBounds (top, top.Frame.X, top.Frame.Y, out int nx, out int ny);
if ((nx != top.Frame.X || ny != top.Frame.Y) && top.LayoutStyle != LayoutStyle.Computed) {
top.X = nx;
top.Y = ny;
}
if (StatusBar != null) {
if (ny + top.Frame.Height > Driver.Rows - 1) {
if (top.Height is Dim.DimFill)
top.Height = Dim.Fill () - 1;
}
if (StatusBar.Frame.Y != Driver.Rows - 1) {
StatusBar.Y = Driver.Rows - 1;
SetNeedsDisplay ();
}
}
}
@@ -311,6 +308,7 @@ namespace Terminal.Gui {
// (the bounds passed to us).
Clear (bounds);
Driver.SetAttribute (Colors.Base.Normal);
PositionToplevels ();
}
foreach (var view in Subviews) {
if (view.Frame.IntersectsWith (bounds)) {

View File

@@ -90,7 +90,7 @@ namespace Terminal.Gui {
Width = Dim.Fill ();
Height = 1;
Application.Resized += (e) => {
LayoutComplete += (e) => {
X = 0;
Height = 1;
if (SuperView == null || SuperView == Application.Top) {