* Make Dialog generic (Dialog<TResult>) for Issue #2443
This is Step 1 of implementing the IRunnable.Prompt API. Key changes:
- Refactor Dialog to be generic: Dialog<TResult> : Runnable<TResult>
- Non-generic Dialog : Dialog<int> for backward compatibility
- Add explicit int? Result property on Dialog for nullable semantics
- Move ConfigurationProperty statics from generic to non-generic Dialog
(ConfigurationManager cannot reflect on open generic types)
- Fix Runnable<TResult>.OnIsRunningChanging to not set Result = default
(was causing value types like int to return 0 instead of null on cancel)
- Update OpenDialog and SaveDialog to use IRunnable.Result for null checks
- Add ColorPickerDialog example in Dialogs.cs scenario showing Dialog<Color>
- Add comprehensive tests for Dialog<TResult> with various result types
- Add DatePicker.ps1 PowerShell example for design validation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Split Dialog into Dialog.cs and DialogTResult.cs, update API doc examples
- Split generic Dialog<TResult> into separate DialogTResult.cs file
- Dialog.cs now contains only non-generic Dialog : Dialog<int>
- Update API doc examples to use target-typed new syntax
- Rename ButtonContainer to _buttonContainer (field naming convention)
- Update Dialogs.cs scenario with improved ColorPickerDialog example
- Minor cleanup in View.Keyboard.cs and ColorPicker.cs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fixed dialog issues.
Partial impl of Prompt.
Refactor Dialogs: robust Accepting, add PromptDialog API
Enhances Dialog and Dialog<TResult> to use Accepting events for button handling and result extraction, replacing OnButtonPressed. Improves API docs and examples, updates MessageBox to handle Accepting and focus default button, and refactors tests for Enter/Space/Esc behavior. Adds generic PromptDialog<TView, TResult> and PromptExtensions for type-safe, high-level modal prompts. Adjusts dialog sizing for better layout. Modernizes dialog creation and result handling throughout Terminal.Gui.
* Add OnAccepting override to PromptDialog for result extraction
PromptDialog now properly extracts results via OnAccepting (following
the standard Command infrastructure pattern) instead of the removed
OnButtonPressed method. When the default button (Ok) is pressed,
ResultExtractor is called to extract the result from the wrapped view.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add PromptDialog demo to Dialogs scenario
Demonstrates using PromptDialog<TView, TResult> with extension methods
as a simpler alternative to creating custom Dialog<TResult> subclasses.
Shows side-by-side comparison with ColorPickerDialog (custom) vs
Prompt<ColorPicker, Color> (using extension method).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add unit tests for PromptDialog and PromptExtensions
22 tests covering:
- Constructor initialization (Ok/Cancel buttons, defaults)
- WrappedView property and addition to SubViews
- ResultExtractor property and functionality
- Button text customization
- Result getting/setting
- Layout functionality
- Various TResult types (DateTime, Color, int, string)
- Title with wide character support
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Rename PromptDialog to Prompt and fix Result getter bug
- Rename PromptDialog<TView, TResult> to Prompt<TView, TResult>
- Rename PromptDialog.cs to Prompt.cs
- Rename PromptDialogTests.cs to PromptTests.cs
- Update all references in PromptExtensions.cs and tests
- Fix Runnable<TResult>.Result getter to return null (not default)
when cancelled, enabling proper cancellation detection for value types
- Update Dialogs.cs scenario labels
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Document TResult must be nullable to detect cancellation
- Add XML doc warning to Runnable<TResult>, Prompt<TView, TResult>, and
PromptExtensions methods explaining that TResult should be a nullable
type (e.g., Color?, int?, string?) so null can indicate cancellation
- Fix Dialogs.cs demo to use Color? instead of Color for Prompt TResult
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* REvised.
* Add comprehensive Prompt API documentation and deep dive
- Add .Text property to ColorPicker and DatePicker for auto-extraction
- Update Prompt.cs XML docs with auto-Text fallback explanation
- Update PromptExtensions.cs with detailed parameter documentation
- Create docfx/docs/prompt.md deep dive with usage patterns
- Add cross-reference links from API docs to deep dive
- Update test names for consistency (remove "Dialog" suffix)
- Add test for ColorPicker Text extraction
- Remove temporary prompt-api-design.md file
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Delete RunnableWrapper and rewrite example to use Prompt API
- Delete RunnableWrapper.cs and ViewRunnableExtensions.cs (now superseded by Prompt)
- Rename RunnableWrapperExample to PromptExample
- Rewrite PromptExample to demonstrate Prompt API patterns:
- TextField with auto-Text extraction
- DatePicker with typed DateTime result
- ColorPicker with typed Color result
- ColorPicker with auto-Text extraction
- Pre-created view pattern
- Custom form with complex result extraction
- FlagSelector with enum result
- Update Terminal.sln to reference PromptExample
- Remove RunnableWrapper reference in TestsAllViews.cs
Prompt API provides the same functionality with better ergonomics:
- Built on Dialog with Ok/Cancel buttons
- Auto-Text fallback when TResult is string
- Extension methods for IRunnable and IApplication
- No required properties - simpler initialization
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Delete ApplicationRunnableExtensions (depends on deleted RunnableWrapper)
- Remove ApplicationRunnableExtensions.RunView() methods
- These extension methods depended on RunnableWrapper which was deleted
- Prompt API provides superior functionality for wrapping views
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Refactor examples, dialogs, and make resources public
- Refactored PromptExample and Example.cs to use using declarations for IApplication and Window, improving resource management and code clarity.
- Modernized button and view creation with object initializers and streamlined prompt/result extraction logic.
- MessageBox dialogs now receive the app instance for context.
- Enabled ConfigurationManager at startup for consistent config.
- DialogTResult.cs refactored for clearer size calculations and concise object initialization.
- Made Strings.Designer.cs and all resource properties public, allowing external access to localized strings.
- Updated Terminal.Gui.csproj to use PublicResXFileCodeGenerator for public resource generation.
- Added PromptExample as a project reference in OutputView.csproj for integration/testing.
- Overall, these changes improve maintainability, resource safety, and enable resource reuse in external projects.
* Fixed bugs.
* tweaking workflow to dl dmp files
* Add AttributePicker view and IValue<T> interface
Introduce AttributePicker for selecting text attributes (color/style) using ColorPicker and FlagSelector subviews. Add IValue<TValue> interface for CWP property/event support in views. Include full unit tests for both AttributePicker and IValue<T>. Update documentation with implementation plan and usage details.
* Move IValue<T> docs to prompt.md and delete attribute-picker.md
Migrate AttributePicker documentation to prompt.md as an example of the
IValue<T> pattern. The IValue<T> interface documentation now lives where
it belongs - in the Prompt documentation - since its primary purpose is
enabling automatic result extraction in Prompt dialogs.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor ColorPicker to use IValue<Color?> and Value events
Refactored ColorPicker to implement IValue<Color?>, introducing a new Value property as the preferred way to get/set the selected color. Added ValueChanging and ValueChanged events for cancellation and notification, while retaining ColorChanged for compatibility. Updated all usages to replace SelectedColor with Value, and revised event handlers accordingly. Removed PromptForColor and standardized color-picking dialogs to use Prompt<ColorPicker, Color?>. Enhanced unit tests for the new API and made minor code style improvements. This refactor improves API consistency and supports MVVM/data-binding scenarios.
* deleted old doc
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Update cleanup agent documentation to clarify that Claude performs
cleanup steps manually (calling individual tools) rather than invoking
CleanupAgent.ps1 as an orchestrator.
Changes:
- Mark CleanupAgent.ps1 as legacy/deprecated in docs
- Remove redundant Examples section (commands already in tool reference)
- Remove File Organization and Future Improvements sections
- Condense ReSharper exception details from 38 lines to 3 lines
- Rename "What CleanupAgent.ps1 did" to "Step Details"
- Fix typos and grammar issues
- Reduce document from ~292 to 185 lines
Also fix PowerShell ternary syntax in CleanupAgent.ps1 exit statement.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated the width of tab3's TextView from 3 to 4 and tab1's TextField from 2 to 4 in TabViewTests.cs to allow for more content and improve layout during testing.
Update TabRow to use IsPressed for mouse event checks, improving consistency. Refactor TextField test to use MoveEnd() for setting insertion point, enhancing clarity and correctness.
* fixed and disabled
* Fix MessageBox not setting SchemeName correctly
Uncommented line in MessageBox.cs that sets the SchemeName property based on whether it's an error dialog or regular dialog. Added unit tests to verify Query sets "Dialog" scheme and ErrorQuery sets "Error" scheme.
Fixes#4567
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
- Changed bash code blocks to powershell in documentation
- Added Get-BuildWarnings function to capture detailed warning info
- Agent now attempts to fix build warnings by re-running ReSharper cleanup
- Up to 2 fix attempts before rolling back
- Outputs detailed warning info for diagnosis
- Only rolls back if unable to fix after all attempts
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fixed extra closing brace syntax error
- Added -Raw parameter to XML parsing (Get-Content)
- Added --format=Xml to inspectcode command to get XML output instead of JSON/SARIF
- Tested successfully with MessageBoxTests.cs
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Track build warnings (compiler) and InspectCode warnings (ReSharper)
- HARD RULE: No new build warnings allowed (fails and rolls back)
- SOFT GOAL: InspectCode warnings should be reduced (reports but doesn't fail)
- Added Get-BuildWarningCount function
- Integrated warning checks into cleanup pipeline
- Updated summary report to show warning deltas
- Updated documentation in cleanup-agent.md
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- After splitting, now processes each partial file through cleanup steps
- Each partial gets: ReSharper cleanup, backing field reorder, nullable, CWP
- Solution rebuild and tests run once after all partials are processed
- Handles both split and non-split cases correctly
- Preserves wasSplit flag for test failure handling
Previously the agent would split files and stop, requiring manual processing.
Now it completes the full cleanup pipeline as originally spec'd.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Document correct ReSharper cleanupcode command with --include parameter
- Tested and verified: --include works correctly for single file cleanup
- Update PowerShell script to pass FilePath parameter and use --include
- Changed verbosity from ERROR to WARN for better visibility
- Document observed exceptions in output (with honest assessment)
- Note: Exceptions appear but command succeeds (exit code 0)
- Update command examples to use WARN verbosity
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Introduces a modular code cleanup system for Terminal.Gui, including:
- cleanup-agent.md: documentation for the new agent, usage, and best practices
- CleanupAgent.ps1: orchestrator script for file splitting, ReSharper cleanup, backing field reordering, nullable directive management, CWP TODOs, and validation/testing
- BackingFieldReorderer: Roslyn tool to move backing fields before their properties
- PartialSplitter: Roslyn tool to split large files into semantic partials
The system supports feature flags, robust error handling, and detailed reporting. Documentation covers limitations, troubleshooting, and future improvements.
* Initial plan
* Reduce macOS parallel thread count and increase hang timeout
- Limit maxParallelThreads to 4 on macOS (down from up to 16) to prevent thread pool exhaustion
- Increase blame-hang-timeout to 120s on macOS (from 60s) to give more time for slower runner
- Keep existing limits for Linux/Windows (16 threads, 60s timeout)
- Addresses intermittent test hangs on macos-latest runners
Co-authored-by: tig <585482+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>
docfx.json was changed in commit 6230028b9 to reference
bin/Release/net10.0/Terminal.Gui.dll directly instead of **/*.csproj.
The workflow needs to build the DLL before running docfx metadata.
Added:
- .NET Core 10.x setup step
- dotnet restore step
- Build Terminal.Gui.csproj in Release configuration
This follows the pattern from build-validation.yml and ensures the
DLL exists before docfx tries to generate API documentation.
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* Refactor ListView: auto-properties, mouse, and selection
Refactored ListView to use auto-properties with backing fields, simplifying property management. Updated mouse event handling to use LeftButtonPressed and added support for double-click and mouse wheel actions via command bindings. Improved logic for marking, unmarking, and selection, with clearer handling of AllowsMarking and AllowsMultipleSelection. Removed OnMouseEvent in favor of command routing. Refactored navigation and rendering methods for clarity and correctness. Updated related tests to match new mouse event handling and skipped a flaky ComboBox test. Performed general code cleanup and modernization.
* Add mouse selection and marking tests for ListView
Added unit tests for mouse-based selection and marking in ListView, including multi-selection and marking toggling. Refactored some variable declarations for clarity, improved test formatting, and added more output assertions. No changes to ListView core logic.
* Refactor ListView: cleanup, UI refresh, minor comments
Cleaned up outdated TODOs and redundant comments in ListView.cs. Refactored suspend/resume collection event methods to single lines. Ensured UI refresh after marking all items by calling SetNeedsDraw(). Updated event model comment for clarity. No changes to core logic.
* Initial plan
* Add ConfigLocations.Env, fix load priorities, move logic to SourcesManager
- Reordered ConfigLocations enum bits so Runtime has highest priority (0x100)
- Added ConfigLocations.Env (0x80) for TUI_CONFIG environment variable
- Moved load ordering logic from ConfigurationManager.Load to SourcesManager.LoadFromLocations
- SourcesManager now iterates through enum in bit order (lower bits first)
- Added comprehensive tests for load priority order
- Updated config.md documentation with corrected precedence and new Env location
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add comprehensive test for ConfigLocations.All load order
- Added ConfigLocations_All_LoadsInCorrectOrder test to verify complete priority chain
- Test validates Runtime has highest priority, followed by Env
- All 34 ConfigurationManager tests pass
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix HardCoded handling when combined with other locations
- LoadHardCodedDefaults clears RuntimeConfig, so only call it when HardCoded is the exclusive location
- When HardCoded is combined with other flags, hard-coded defaults are already in Settings from Enable()
- All 1075 UnitTests pass including new comprehensive tests
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Address code review feedback: improve enum and caching
- Changed None enum to use simple `0` instead of binary literal
- Changed All enum to use bitwise OR of all flags for maintainability
- Added static readonly cache for sorted ConfigLocations to avoid repeated allocations
- Improved clarity of priority order comment in test
- All 1075 UnitTests pass
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Final code review improvements: robustness and documentation
- Use power-of-2 check for filtering ConfigLocations (more robust than hardcoded exclusions)
- Made _configFilename internal and use it consistently in SourcesManager
- Added WARNING documentation to LoadHardCodedDefaults about side effects
- All 1075 UnitTests pass
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor config management and source loading for clarity
- Replace object locks with custom Lock type for thread safety
- Rename _configFilename to public ConfigFilename constant
- Refactor AppName property and locking logic
- Remove unnecessary nullability from internal methods
- Simplify ThemeManager theme application calls
- Standardize comments and XML docs
- Use constants for config folder and env variable names
- Update file/resource path construction for maintainability
- Refactor AddOrUpdate lambda and local variable declarations
- Improve error handling and logging in loading methods
- General code cleanup for readability and consistency
---------
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: Tig <tig@users.noreply.github.com>
- Added _focusSetByMouse flag to track focus source
- Modified OnHasFocusChanged to select all text when focus gained via keyboard
- Mouse clicks continue to clear selection and position cursor
- Updated existing tests that relied on SetFocus not selecting text
- Added comprehensive parallelizable tests for new behavior
Co-authored-by: tig <585482+tig@users.noreply.github.com>
When Arrangement mode is active (Ctrl+F5), buttons are added to the Border
to show move/resize indicators. These buttons have MouseHighlightStates
configured by default, which was causing GetAttributeForRole to return
Highlight colors instead of Focus colors when the buttons had focus.
This fix restores the `&& !HasFocus` condition that was previously removed
in commit 07cee7174 during the massive mouse refactoring. This condition
ensures that when a view has focus, mouse highlight does not override focus
colors, making focus indication visible for keyboard navigation.
Changes:
- Restored `&& !HasFocus` check in GetAttributeForRole (View.Drawing.Attribute.cs:72)
- Added comprehensive ArrangementFocusTests.cs with 5 tests validating:
* Focused views with MouseHighlightStates show focus colors (not highlight)
* Unfocused views with MouseHighlightStates show highlight colors
* Both mouse-over and mouse-pressed scenarios work correctly
All 13,076 existing tests pass with this fix.
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add ScenarioRunner project and extract Runner class (#4417)
- Create Examples/ScenarioRunner project with CLI for running scenarios
- Extract Runner class to UICatalog with RunScenario and benchmark methods
- Refactor UICatalog.cs to use the shared Runner class
- CLI supports: list, run <scenario>, benchmark [scenario]
Part of issue #4417 - Phase 4 implementation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* tweaks
* Extract interactive mode loop and config watcher to Runner class
- Move RunInteractive<T>() method to Runner class for reusable scenario
browser loop with config file watching
- Add Force16Colors option to ScenarioRunner and UICatalog CLI
- Add ApplyRuntimeConfig() to Runner for consistent driver/color settings
- Refactor UICatalog to delegate to Runner.RunInteractive<UICatalogRunnable>()
- Remove duplicated config watcher and verification code from UICatalog
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor to use IApplication; remove static Application usage
Refactored the codebase to adopt the new IApplication interface and instance-based application lifecycle management. Replaced static Application.Init/Shutdown/Run calls with Application.Create()/app.Init()/app.Run() patterns for proper disposal and flexibility. Updated usages of Application.Driver and Application.IsMouseDisabled to use instance-based access via App or Driver.
Modernized event handler patterns, made UI fields nullable and non-readonly, and improved scenario launching logic. Switched driver name retrieval to DriverRegistry.GetDriverNames(). Cleaned up command-line parsing and removed obsolete suppressions. Added "Dont" to the user dictionary.
These changes reduce reliance on static state, improve maintainability, and align the codebase with current Terminal.Gui best practices.
* Modernize scenarios to use instance-based Application model and add lifecycle events
Update all UICatalog scenarios to use the modern instance-based Application pattern
(Application.Create() / app.Init()) instead of the legacy static pattern. Add thread-local
static events (InstanceCreated, InstanceInitialized, InstanceDisposed) to Application for
monitoring application lifecycle in tests. Update ScenarioTests to use new events and
fix documentation examples in arrangement.md and config.md.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add FSharpExample project to solution
Added a new F# example project (FSharpExample) to the solution under the Examples folder. Updated the solution file to include the project, its GUID, and configuration mappings for Debug and Release builds. This improves language coverage in the example set.
* Remove FSharpExample project from solution
* Remove custom handling of Application.QuitKey
Eliminated code that saved, restored, and modified Application.QuitKey.
The application no longer changes the QuitKey to Ctrl+F4 on load,
and no longer restores the original QuitKey after execution.
* Fix LineDrawing.PromptForColor to use IApplication and add try/catch to scenario tests
- Add IApplication parameter to PromptForColor method so dialogs can run properly
with the modern instance-based Application model
- Update all callers in LineDrawing.cs, RegionScenario.cs, and ProgressBarStyles.cs
- Add try/catch around scenario execution in ScenarioTests to prevent test host
crashes when scenarios throw exceptions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add in-memory log capture for scenario debugging with error dialog
- Add ScenarioLogCapture class (ILoggerProvider) for capturing logs in-memory
- Integrate LogCapture into UICatalog logger factory
- Add MarkScenarioStart/GetScenarioLogs for scenario-scoped log capture
- Track HasErrors flag for Error-level and above logs
- Add unit tests for ScenarioLogCapture (17 tests)
- Add unit tests for Runner class (8 tests)
- Various refactoring and cleanup
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix benchmark mode to use instance-based Application model
- Update Scenario.StartBenchmark to use Application.InstanceInitialized
and Application.InstanceDisposed instead of legacy InitializedChanged
- Store app instance and use it for timeouts, events, and InjectKey
- Fix UICatalog.cs to pass options.Benchmark instead of hardcoded false
- Add XML documentation to BenchmarkResults and Scenario benchmark APIs
- Use expression-bodied members for simple Scenario methods
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fixed bug.
* fixed bug
* Fix Release build failures
- Wrap View.VerifyViewsWereDisposed() calls in #if DEBUG_IDISPOSABLE
(method only exists in Debug builds)
- Change SelfContained and NativeAot to always use ProjectReference
(fixes build order issues in Release configuration)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* tweaked gitignore
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>