From 786b7670da5bce21d914ad652c00834ce9a2df94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Tue, 31 Aug 2021 15:38:08 +0200 Subject: [PATCH] Fix the style parameter nullable annotation on AnsiConsoleExtensions The style parameter is actually nullable. Also, the documentation of the style parameter has been made explicit that `Style.Plain` is used when a `null` style is passed. --- src/Spectre.Console/Extensions/AnsiConsoleExtensions.cs | 8 ++++---- src/Spectre.Console/Widgets/Paragraph.cs | 4 ++-- src/Spectre.Console/Widgets/Text.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Spectre.Console/Extensions/AnsiConsoleExtensions.cs b/src/Spectre.Console/Extensions/AnsiConsoleExtensions.cs index 1ba2681..92c57e4 100644 --- a/src/Spectre.Console/Extensions/AnsiConsoleExtensions.cs +++ b/src/Spectre.Console/Extensions/AnsiConsoleExtensions.cs @@ -51,8 +51,8 @@ namespace Spectre.Console /// /// The console to write to. /// The text to write. - /// The text style. - public static void Write(this IAnsiConsole console, string text, Style style) + /// The text style or if . + public static void Write(this IAnsiConsole console, string text, Style? style) { if (console is null) { @@ -91,8 +91,8 @@ namespace Spectre.Console /// /// The console to write to. /// The text to write. - /// The text style. - public static void WriteLine(this IAnsiConsole console, string text, Style style) + /// The text style or if . + public static void WriteLine(this IAnsiConsole console, string text, Style? style) { if (console is null) { diff --git a/src/Spectre.Console/Widgets/Paragraph.cs b/src/Spectre.Console/Widgets/Paragraph.cs index 5b29f0c..6f30bc6 100644 --- a/src/Spectre.Console/Widgets/Paragraph.cs +++ b/src/Spectre.Console/Widgets/Paragraph.cs @@ -47,7 +47,7 @@ namespace Spectre.Console /// Initializes a new instance of the class. /// /// The text. - /// The style of the text. + /// The style of the text or if . public Paragraph(string text, Style? style = null) : this() { @@ -63,7 +63,7 @@ namespace Spectre.Console /// Appends some text to this paragraph. /// /// The text to append. - /// The style of the appended text. + /// The style of the appended text or if . /// The same instance so that multiple calls can be chained. public Paragraph Append(string text, Style? style = null) { diff --git a/src/Spectre.Console/Widgets/Text.cs b/src/Spectre.Console/Widgets/Text.cs index ae0fee0..239ac02 100644 --- a/src/Spectre.Console/Widgets/Text.cs +++ b/src/Spectre.Console/Widgets/Text.cs @@ -29,7 +29,7 @@ namespace Spectre.Console /// Initializes a new instance of the class. /// /// The text. - /// The style of the text. + /// The style of the text or if . public Text(string text, Style? style = null) { _paragraph = new Paragraph(text, style);