This release brings new features, performance improvements, bug fixes, and some important architectural changes.
Caution
There are breaking changes in this release, so make sure you review the release notes and try things out before upgrading in production.
New Spectre.Console.Ansi Library
One of the biggest changes in this release is the introduction of
Spectre.Console.Ansi,
a new standalone library for writing ANSI escape
sequences to the terminal without taking a full dependency on Spectre.Console.
This makes it easy to add ANSI support to lightweight tools and libraries where
pulling in the full Spectre.Console package would be overkill. Spectre.Console
itself now depends on this library internally.
We've also added some nice convenience methods for the .NET Console class:
using Spectre.Console.Ansi;
Console.Markup("[yellow]Hello[/] ");
Console.MarkupLine("[blue]World[/]");
Console.Ansi(writer => writer
.BeginLink("https://spectreconsole.net", linkId: 123)
.Decoration(Decoration.Bold | Decoration.Italic)
.Foreground(Color.Yellow)
.Write("Spectre Console")
.ResetStyle()
.EndLink());Style Is Now a Struct
Style has been converted from a class to a struct, and link/URL information
has been extracted into a separate Link type. This improves allocation
performance, especially in rendering-heavy scenarios, but is a breaking change
for code that relies on reference semantics.
Progress Improvements
The Progress widget received a lot of love in this release. It now uses
TimeProvider instead of the wall clock, making it significantly easier to
write deterministic tests. ProgressTask has a new Tag property for attaching
arbitrary metadata, and you can now override the global hide-when-completed
behavior on individual tasks. Tasks can also be removed from the progress
context entirely.
Speed calculations have been improved with configurable max sampling age and
sample count, giving you more control over how responsive or smooth the speed
readout is. Speed calculations for stopped tasks have been fixed, and
indeterminate tasks no longer show a meaningless time estimate.
Prompt Enhancements
Prompts now accept a CancellationToken, making it possible to cancel a waiting
prompt programmatically. TextPrompt default values can now be edited by the
user instead of being accepted or rejected as a whole. There is also a new
option to clear the prompt line after the user provides input.
Tables and Rendering
Table body rows now support column spans, and a new minimal border style has
been added for a cleaner look. The Canvas widget gained half-block support,
which enables double the vertical resolution when rendering graphics. JsonText
now has a configurable indentation depth. Various performance improvements have
also been made to Markup instantiation and formatting.
Bug Fixes
A memory leak related to Segment has been fixed, along with
Segment.SplitLines ignoring multiple consecutive line breaks. A crash in
SegmentShape.Calculate when the lines list was empty has been resolved.
Interactive console detection when output is redirected now works correctly,
and table expand now properly respects fixed column widths. Truncation and
overflow handling for fullwidth characters has been corrected, and locking
performance on .NET 9.0+ has been improved.
Breaking Changes
This release contains several breaking changes. Please review the following
before upgrading.
Style is now a struct. Code relying on reference semantics such as null
checks or reference equality will need to be updated. Related to this, link
and URL information has moved from Style to a new Link type, so any code
that reads or writes links through Style will need to be adjusted.
Several previously obsoleted members have been removed. The Alignment property
on Calendar, Table, and Grid, as well as the Render extension method,
no longer exist. AnsiConsoleFactory has been made static and internal, so code
that instantiated this class directly will need an alternative approach.
Finally, ANSI output is now disabled when stdout or stderr is redirected. This
is a behavior change: output that previously included ANSI escape codes when
piped or redirected will now be plain text.
What's Changed
- Add Polyfill package by @patriksvensson in #1956
- Update dependencies by @patriksvensson in #1959
- Modernization of the code base by @patriksvensson in #1993
- Add source generation for colors, emojis and spinners by @phil-scott-78 in #1995
- Revert commits related to modernization of code by @patriksvensson in #1999
- Add half-block support to Canvas by @patriksvensson in #2002
- Modernize and clean up the code base a bit by @patriksvensson in #2004
- Add benchmarks for rendering by @patriksvensson in #2007
- Add Spectre.Console.Ansi Project by @patriksvensson in #2006
- Separate links from
Styleby @patriksvensson in #2013 - Remove obsoleted members by @patriksvensson in #2017
- chore: Update dotnet monorepo by @renovate[bot] in #2018
- Fix SplitOverflow with fullwidth characters by @bijesh-bits in #2009
- Fix expand respecting fixed table column widths by @bijesh-bits in #2010
- Use TimeProvider for Progress by @patriksvensson in #2021
- chore: Update dependency Microsoft.Bcl.TimeProvider to v10 by @renovate[bot] in #2023
- docs: fix typo SRG → SGR in README files by @bijesh-bits in #1998
- Added column spanning support for table body rows (#24) by @thomastv in #2020
- chore: Update dependency Polyfill to 9.10.0 by @renovate[bot] in #2024
- chore: Update dependency Microsoft.NET.Test.Sdk to 18.3.0 by @renovate[bot] in #2026
- chore: Update dependency Polyfill to 9.11.0 by @renovate[bot] in #2027
- Various optimisations to Markup instantiation & formatting by @benbryant0 in #2008
- Add option to clear TextPrompt after input by @ThePCJakub in #1979
- Progressbar tag support v2 pr by @mitchcapper in #2025
- chore: Update dependency Polyfill to 9.12.0 by @renovate[bot] in #2030
- chore: Update actions/upload-artifact action to v7 by @renovate[bot] in #2031
- chore: Update dependency Polyfill to 9.13.0 by @renovate[bot] in #2032
- Fix crash in SegmentShape.Calculate when lines list is empty by @rodrigomfvn in #2036
- chore: Update dependency Polyfill to 9.15.0 by @renovate[bot] in #2037
- Feature/cancel prompt by @red-stronghold in #2028
- Improve locking performance on .NET 9.0+ by @MarkCiliaVincenti in #1991
- chore: Update dependency Polyfill to 9.17.0 by @renovate[bot] in #2038
- Text prompt editable default by @MapelSiroup in #2016
- chore: Update dependency Polyfill to 9.18.0 by @renovate[bot] in #2039
- chore: Update dependency Microsoft.CodeAnalysis.Analyzers to v5 by @renovate[bot] in #2041
- chore: Update dotnet monorepo by @renovate[bot] in #2040
- chore: Update dotnet monorepo by @renovate[bot] in #2043
- Fix interactive console detection when output is redirected (#1810) by @1PetarVujakovic in #2042
- Add minimal table style by @patriksvensson in #2045
- Fix memory leak bug related to Segment by @patriksvensson in #2046
- Add setting for JSON indentation by @patriksvensson in #2048
- Disable ANSI when stdout or stderr is redirected by @1PetarVujakovic in #2047
- chore: Update dependency Polyfill to 9.20.0 by @renovate[bot] in #2049
- chore: Update dependency Polyfill to 9.21.0 by @renovate[bot] in #2050
- Escape text in AnsiMarkupSegment.ToString() by @mitchdenny in #2055
- chore: Update azure/login action to v3 by @renovate[bot] in #2056
- Fix Segment.SplitLines ignoring multiple line breaks by @1PetarVujakovic in #2052
- Add missing ANSI/VT sequences by @patriksvensson in #2058
- chore: Update dependency Polyfill to 9.22.0 by @renovate[bot] in #2051
- chore: Update dependency Backport.System.Threading.Lock to 3.1.8 by @renovate[bot] in #2053
- chore: Update dependency Polyfill to 9.23.0 by @renovate[bot] in #2060
- chore: Update dependency Polyfill to 9.24.0 by @renovate[bot] in #2068
New Contributors
- @bijesh-bits made their first contribution in #2009
- @thomastv made their first contribution in #2020
- @benbryant0 made their first contribution in #2008
- @ThePCJakub made their first contribution in #1979
- @mitchcapper made their first contribution in #2025
- @rodrigomfvn made their first contribution in #2036
- @red-stronghold made their first contribution in #2028
- @MarkCiliaVincenti made their first contribution in #1991
- @MapelSiroup made their first contribution in #2016
- @1PetarVujakovic made their first contribution in #2042
Full Changelog: 0.54.0...0.55.0