Skip to content

Commit 87c6859

Browse files
committed
fix: Corrected footer line calculation
1 parent 9effc63 commit 87c6859

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/Layout/AppShell.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,30 @@ public sealed class AppShell(
3535
public override void Render()
3636
{
3737
Console.Clear();
38-
3938
int width = Console.WindowWidth;
4039
ColorScheme colors = ActiveTheme.Colors;
4140

4241
string headerText = ConsoleHelper.PadCenter($" {Title.ToUpperInvariant()} ", width - 2);
4342
new Panel(title: null, content: new ConsoleText(headerText, colors.Highlight)).Render();
44-
4543
ConsoleHelper.WriteEmptyLines(1);
4644

4745
Content.Render();
4846

49-
int currentLine = Console.CursorTop;
50-
int footerLine = Console.WindowHeight - 3; // Account for the panel's borders
47+
int contentEndLine = Console.CursorTop;
5148

52-
if (currentLine < footerLine)
49+
int footerLine = Console.WindowHeight - 3;
50+
if (contentEndLine < footerLine)
5351
{
54-
ConsoleHelper.WriteEmptyLines(footerLine - currentLine);
52+
ConsoleHelper.WriteEmptyLines(footerLine - contentEndLine);
5553
}
5654

5755
string footerL = LeftFooter ?? string.Empty;
5856
string footerR = RightFooter ?? string.Empty;
59-
6057
int spaceCount = Math.Max(0, width - 4 - footerL.Length - footerR.Length);
6158
string footerText = footerL + new string(' ', spaceCount) + footerR;
6259

6360
new Panel(title: null, content: new ConsoleText(footerText, colors.Muted)).Render();
61+
62+
Console.SetCursorPosition(0, contentEndLine);
6463
}
6564
}

0 commit comments

Comments
 (0)