mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00
Add Padding extension
Add extension method for specifying horizontal and vertical padding. Similar constructor for `Padding` already existed. Update documentation for table column appearance (padding). Update `Should_Render_Padded_Object_Correctly_When_Nested_Within_Other_Object` test to use new extension method.
This commit is contained in:

committed by
Patrik Svensson

parent
9915a0d6a8
commit
bca1c889d1
@ -80,7 +80,7 @@ namespace Spectre.Console
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the left and right padding.
|
||||
/// Sets the left, top, right and bottom padding.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">An object implementing <see cref="IPaddable"/>.</typeparam>
|
||||
/// <param name="obj">The paddable object instance.</param>
|
||||
@ -95,6 +95,20 @@ namespace Spectre.Console
|
||||
return Padding(obj, new Padding(left, top, right, bottom));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the horizontal and vertical padding.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">An object implementing <see cref="IPaddable"/>.</typeparam>
|
||||
/// <param name="obj">The paddable object instance.</param>
|
||||
/// <param name="horizontal">The left and right padding.</param>
|
||||
/// <param name="vertical">The top and bottom padding.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static T Padding<T>(this T obj, int horizontal, int vertical)
|
||||
where T : class, IPaddable
|
||||
{
|
||||
return Padding(obj, new Padding(horizontal, vertical));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the padding.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user