diff --git a/src/Spectre.Console/Prompts/List/ListPromptConstants.cs b/src/Spectre.Console/Prompts/List/ListPromptConstants.cs index 4c0e2b0..ea1f32e 100644 --- a/src/Spectre.Console/Prompts/List/ListPromptConstants.cs +++ b/src/Spectre.Console/Prompts/List/ListPromptConstants.cs @@ -9,4 +9,15 @@ internal sealed class ListPromptConstants public const string InstructionsMarkup = "[grey](Press to select, to accept)[/]"; public const string MoreChoicesMarkup = "[grey](Move up and down to reveal more choices)[/]"; public const string SearchPlaceholderMarkup = "[grey](Type to search)[/]"; + + public static string GetSelectedCheckbox(bool isGroup, SelectionMode mode, Style? style = null) + { + if (style != null) + { + return "[[" + $"[{style.ToMarkup()}]X[/]" + "]]"; + } + + return isGroup && mode == SelectionMode.Leaf + ? GroupSelectedCheckbox : SelectedCheckbox; + } } \ No newline at end of file diff --git a/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs b/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs index 8c63e2e..ffc3f4e 100644 --- a/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs +++ b/src/Spectre.Console/Prompts/MultiSelectionPrompt.cs @@ -257,8 +257,7 @@ public sealed class MultiSelectionPrompt : IPrompt>, IListPromptStrat } var checkbox = item.Node.IsSelected - ? (item.Node.IsGroup && Mode == SelectionMode.Leaf - ? ListPromptConstants.GroupSelectedCheckbox : ListPromptConstants.SelectedCheckbox) + ? ListPromptConstants.GetSelectedCheckbox(item.Node.IsGroup, Mode, HighlightStyle) : ListPromptConstants.Checkbox; grid.AddRow(new Markup(indent + prompt + " " + checkbox + " " + text, style)); diff --git a/src/Spectre.Console/Widgets/Calendar.cs b/src/Spectre.Console/Widgets/Calendar.cs index 0448cdd..124b62c 100644 --- a/src/Spectre.Console/Widgets/Calendar.cs +++ b/src/Spectre.Console/Widgets/Calendar.cs @@ -195,7 +195,7 @@ public sealed class Calendar : JustInTimeRenderable, IHasCulture, IHasTableBorde while (currentDay <= daysInMonth) { if (weekdays[currentDay - 1] == weekday) - { + { var todayEvent = _calendarEvents.LastOrDefault(e => e.Month == Month && e.Day == currentDay); if (todayEvent != null) { diff --git a/src/Spectre.Console/Widgets/CalendarEvent.cs b/src/Spectre.Console/Widgets/CalendarEvent.cs index bc8bf52..3231823 100644 --- a/src/Spectre.Console/Widgets/CalendarEvent.cs +++ b/src/Spectre.Console/Widgets/CalendarEvent.cs @@ -28,34 +28,34 @@ public sealed class CalendarEvent /// /// Gets the custom highlight style of the calendar event. /// - public Style? CustomHighlightStyle { get; } - + public Style? CustomHighlightStyle { get; } + /// /// Initializes a new instance of the class. /// /// The year of the calendar event. /// The month of the calendar event. - /// The day of the calendar event. + /// The day of the calendar event. /// The custom highlight style of the calendar event. public CalendarEvent(int year, int month, int day, Style? customHighlightStyle = null) : this(string.Empty, year, month, day, customHighlightStyle) { - } - + } + /// /// Initializes a new instance of the class. /// /// The calendar event description. /// The year of the calendar event. /// The month of the calendar event. - /// The day of the calendar event. + /// The day of the calendar event. /// The custom highlight style of the calendar event. public CalendarEvent(string description, int year, int month, int day, Style? customHighlightStyle = null) { Description = description ?? string.Empty; Year = year; Month = month; - Day = day; + Day = day; CustomHighlightStyle = customHighlightStyle; } } \ No newline at end of file