Copilot fb4043afbc Fixes #3829. Rename Slider to LinearRange and implement CWP (#4509)
* Initial plan

* Rename Slider to LinearRange - files and code updated

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix variable name mismatches in scenario files

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix typos in comments identified by code review

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Update HelpText for consistency with LinearRange rename

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Refactor LinearRange properties to use CWP with CWPPropertyHelper

- Added CWP events (Changing/Changed) for Type, LegendsOrientation, MinimumInnerSpacing, ShowLegends, ShowEndSpacing, and UseMinimumSize properties
- Used CWPPropertyHelper for consistent property change workflow
- Added virtual OnChanging/OnChanged methods for each property
- All existing tests pass

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix CWP property implementations - remove duplicate field updates in doWork

- CWPPropertyHelper updates the ref parameter, so doWork should only contain side effects
- Fixed Type, MinimumInnerSpacing, LegendsOrientation, ShowLegends, ShowEndSpacing, and UseMinimumSize
- Added comprehensive CWP tests for property changes (9 new tests, all passing)
- All 45 pre-existing LinearRange tests still pass (10 were already failing before changes)

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Add fluent integration tests for LinearRange

- Created LinearRangeFluentTests with 5 test scenarios
- Tests cover rendering, navigation, type changes with CWP events, range selection, and vertical orientation
- All tests build successfully

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Fix unit tests and address review comments

- Fixed review comments: Updated Title properties from "_Slider" to "_LinearRange" in DimAutoDemo and ViewportSettings
- Fixed review comment: Renamed filterSlider to filterLinearRange in Mouse.cs
- Fixed CWP implementation: Use local variable instead of backing field as ref parameter to CWPPropertyHelper
- This ensures doWork can update the backing field BEFORE SetContentSize() reads it
- All 55 LinearRange tests now passing (was 45/55, now 55/55)

Co-authored-by: tig <585482+tig@users.noreply.github.com>

* Update DimAutoDemo.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update ViewportSettings.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* code cleanup

* Refactor LinearRanges scenario for clarity and modularity

Refactored the LinearRanges scenario to separate UI setup, configuration, and event logic. The Main() method now handles all UI layout, configuration controls, and event wiring, while MakeSliders() is responsible only for adding LinearRange controls to the main window. Updated event handlers to use discard parameters for unused arguments and modernized code with collection initializers and LINQ. This results in a clearer separation of concerns and improved maintainability.

* un did change

* cleanup

* cleanup

* cleanup

* fixed unit test
code cleanup

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-21 10:40:09 -07:00

Version codecov Downloads License Bugs

Terminal.Gui v2

Cross-platform UI toolkit for building sophisticated terminal UI (TUI) applications on Windows, macOS, and Linux/Unix.

logo

  • v2 Alpha (Current): NuGet Version - Recommended for new projects
  • v1 (Legacy): Version - Maintenance mode only

Important:

  • v1 is in maintenance mode - only critical bug fixes accepted
  • v2 Alpha is recommended for new projects - API is stable with comprehensive features
  • Breaking changes possible before Beta, but core architecture is solid

Sample app

Quick Start

Install the Terminal.Gui.Templates, create a new TUI app, and run it:

dotnet new --install Terminal.Gui.templates
dotnet new tui -n myproj
cd myproj
dotnet run

Press Esc to exit (the default QuitKey).

Run the comprehensive UI Catalog demo to explore all controls:

dotnet run --project Examples/UICatalog/UICatalog.csproj

Simple Example

using Terminal.Gui;

using IApplication app = Application.Create ();
app.Init ();

using Window window = new () { Title = "Hello World (Esc to quit)" };
Label label = new ()
{
    Text = "Hello, Terminal.Gui v2!",
    X = Pos.Center (),
    Y = Pos.Center ()
};
window.Add (label);

app.Run (window);

See the Examples directory for more.

Build Powerful Terminal Applications

Terminal.Gui enables building sophisticated console applications with modern UIs:

  • Rich Forms and Dialogs - Text fields, buttons, checkboxes, radio buttons, and data validation
  • Interactive Data Views - Tables, lists, and trees with sorting, filtering, and in-place editing
  • Visualizations - Charts, graphs, progress indicators, and color pickers with TrueColor support
  • Text Editors - Full-featured text editing with clipboard, undo/redo, and Unicode support
  • File Management - File and directory browsers with search and filtering
  • Wizards and Multi-Step Processes - Guided workflows with navigation and validation
  • System Monitoring Tools - Real-time dashboards with scrollable, resizable views
  • Configuration UIs - Settings editors with persistent themes and user preferences
  • Cross-Platform CLI Tools - Consistent experience on Windows, macOS, and Linux
  • Server Management Interfaces - SSH-compatible UIs for remote administration

See the Views Overview for available controls and What's New in v2 for architectural improvements.

Documentation

Comprehensive documentation is at gui-cs.github.io/Terminal.Gui.

Getting Started

Migration & Deep Dives

See the documentation index for all topics.

Installing

dotnet add package Terminal.Gui --version "2.0.0-alpha.*"

v2 Develop (Latest)

dotnet add package Terminal.Gui --version "2.0.0-develop.*"

v1 Legacy

dotnet add package Terminal.Gui --version "1.*"

Or use the Terminal.Gui.Templates.

Contributing

Contributions welcome! See CONTRIBUTING.md.

History

See gui-cs for project history and origins.

Languages
C# 99.4%
PowerShell 0.6%