mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00
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:

committed by
Patrik Svensson

parent
037a215a78
commit
041bd016a2
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user