Add Layout widget (#1041)

* Add width to panels
* Add height to panels
* Replace RenderContext with RenderOptions
* Remove exclusivity from alternative buffer
* Add Layout widget
* Add Align widget
This commit is contained in:
Patrik Svensson
2022-11-15 10:12:17 +01:00
committed by GitHub
parent 9ce3b99cd6
commit c3ec6a7363
137 changed files with 2651 additions and 387 deletions

View File

@ -27,11 +27,17 @@ public sealed class TestCapabilities : IReadOnlyCapabilities
public bool Unicode { get; set; }
/// <summary>
/// Creates a <see cref="RenderContext"/> with the same capabilities as this instace.
/// Creates a <see cref="RenderOptions"/> with the same capabilities as this instace.
/// </summary>
/// <returns>A <see cref="RenderContext"/> with the same capabilities as this instace.</returns>
public RenderContext CreateRenderContext()
/// <param name="console">The console.</param>
/// <returns>A <see cref="RenderOptions"/> with the same capabilities as this instace.</returns>
public RenderOptions CreateRenderContext(IAnsiConsole console)
{
return new RenderContext(this);
if (console is null)
{
throw new ArgumentNullException(nameof(console));
}
return RenderOptions.Create(console, this);
}
}

View File

@ -52,6 +52,31 @@ public static class TestConsoleExtensions
return console;
}
/// <summary>
/// Sets the console height.
/// </summary>
/// <param name="console">The console.</param>
/// <param name="width">The console height.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static TestConsole Height(this TestConsole console, int width)
{
console.Profile.Height = width;
return console;
}
/// <summary>
/// Sets the console size.
/// </summary>
/// <param name="console">The console.</param>
/// <param name="size">The console size.</param>
/// <returns>The same instance so that multiple calls can be chained.</returns>
public static TestConsole Size(this TestConsole console, Size size)
{
console.Profile.Width = size.Width;
console.Profile.Height = size.Height;
return console;
}
/// <summary>
/// Turns on emitting of VT/ANSI sequences.
/// </summary>