mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
4.4 KiB
4.4 KiB
Terminal.Gui v2
Check out this Discussion: https://github.com/gui-cs/Terminal.Gui/discussions/2448
- Modern Look & Feel - Apps built with Terminal.Gui now feel modern thanks to these improvements:
- TrueColor support - 24-bit color support for Windows, Mac, and Linux. Legacy 16-color systems are still supported, automatically. See TrueColor for details.
- User Configurable Color Themes - See Color Themes for details.
- *Enhanced Unicode/Wide Character support *- Terminal.Gui now supports the full range of Unicode/wide characters. See Unicode for details.
- Line Canvas - Terminal.Gui now supports a line canvas enabling high-performance drawing of lines and shapes using box-drawing glyphs.
LineCanvasprovides auto join, a smart TUI drawing system that automatically selects the correct line/box drawing glyphs for intersections making drawing complex shapes easy. See Line Canvas for details. - Enhanced Borders and Padding - Terminal.Gui now supports a
Border,Margin, andPaddingproperty on all views. This simplifies View development and enables a sophisticated look and feel. See Padding for details. - Modern File Dialog - Terminal.Gui now supports a modern file dialog that includes icons (in TUI!) for files/folders, search, and a `TreeView``. See FileDialog for details.
- Configuration Manager - Terminal.Gui now supports a configuration manager enabling library and app settings to be persisted and loaded from the file system. See Configuration Manager for details.
- Simplified API - The entire library has been reviewed and simplified. As a result, the API is more consistent and uses modern .NET API standards (e.g. for events). This refactoring resulted in the removal of thousands of lines of code, better unit tests, and higher performance than v1. See Simplified API for details.
- View Lifetime Management is Now Deterministic - In v1 the rules ofr lifetime management of
Viewobjects was unclear and led to non-dterministic behavior and hard to diagnose bugs. This was particularly acute in the behavior ofApplication.Run. In v2, the rules are clear and the code and unit test infrastructure tries to enforce them.Viewand all subclasses supportIDisposableand must be disposed (by callingview.Dispose ()) by whatever code owns the instance when the instance is longer needed.- To simplify programming, any
Viewadded as a Subview anotherViewwill have it's lifecycle owned by the Superview; when aViewis disposed, it will callDisposeon all the items in theSubviewsproperty. Note this behavior is the same as it was in v1, just clarified. - In v1,
Application.EndcalledDispose ()onApplication.Top(viaRunstate.Toplevel). This was incorrect as it meant that afterApplication.Runreturned,Application.Tophad been disposed, and any code that wanted to interogate the results ofRunby accessingApplication.Toponly worked by accident. This is because GC had not actually happened; if it had the application would have crashed. In v2Application.Enddoes NOT callDispose, and it is the caller toApplication.Runwho is responsible for disposing theToplevelthat was either passed toApplication.Run (View)or created byApplication.Run<T> ().- Any code that creates a
Toplevel, either by usingtop = new()or by calling eithertop = Application.Run ()ortop = ApplicationRun<T>()must calltop.Disposewhen complete. - The exception to this is if
topis passed tomyView.Add(top)making it a subview ofmyView. This is because the semantics ofAddare that themyViewtakes over responsibility for the subviews lifetimes. Of course, if someone callsmyView.Remove(top)to remove said subview, they then re-take responsbility fortop's lifetime and they must calltop.Dispose.
- Any code that creates a
...