Remove verbs from extension methods

Removed the verbs from all extension methods that manipulate
properties which makes the API more succinct and easier to read.

Also added implicit conversion from string to Style.

As a good OSS citizen, I've obsoleted the old methods with
a warning for now, so this shouldn't break anyone using
the old methods.
This commit is contained in:
Patrik Svensson
2020-10-22 00:32:07 +02:00
committed by Patrik Svensson
parent 037a215a78
commit 041bd016a2
53 changed files with 1021 additions and 245 deletions

View File

@ -72,7 +72,7 @@ namespace Spectre.Console
/// <inheritdoc/>
protected override IEnumerable<Segment> Render(RenderContext context, int maxWidth)
{
var border = Border.GetSafeBorder((context.LegacyConsole || !context.Unicode) && UseSafeBorder);
var border = BoxExtensions.GetSafeBorder(Border, (context.LegacyConsole || !context.Unicode) && UseSafeBorder);
var borderStyle = BorderStyle ?? Style.Plain;
var child = new Padder(_child, Padding);

View File

@ -408,8 +408,8 @@ namespace Spectre.Console
}
var paragraph = new Markup(header.Text.Capitalize(), header.Style ?? defaultStyle)
.SetAlignment(Justify.Center)
.SetOverflow(Overflow.Ellipsis);
.Alignment(Justify.Center)
.Overflow(Overflow.Ellipsis);
var items = new List<Segment>();
items.AddRange(((IRenderable)paragraph).Render(context, tableWidth));

View File

@ -41,7 +41,7 @@ namespace Spectre.Console
/// </summary>
/// <param name="text">The table column text.</param>
public TableColumn(string text)
: this(new Markup(text).SetOverflow(Overflow.Ellipsis))
: this(new Markup(text).Overflow(Overflow.Ellipsis))
{
}