Commit Graph

8492 Commits

Author SHA1 Message Date
Tig
56d6ac4671 Fixes #2443 - Adds generic Prompt that enables any View to be a Dialog with typed input/output (#4571)
* 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>
2026-01-15 15:44:09 -07:00
Tig
e1921ff8b7 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-15 08:48:54 -07:00
Tig
5cfe526240 fixed dot settings 2026-01-15 08:22:40 -07:00
Tig
8f34e8e0fe Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-14 21:09:13 -07:00
Tig
7ccbf4e020 Merge pull request #4574 from tig/cleanup-agent-docs-update 2026-01-14 19:57:23 -07:00
Tig
d4ed07dcde Merge branch 'v2_develop' into cleanup-agent-docs-update 2026-01-14 18:26:15 -07:00
Tig
7684cdabbe Cleanup TableView: split into partials, fix warnings
- Split TableView.cs (2220 lines) into 5 semantic partial files:
  - TableView.cs (998 lines) - core functionality
  - TableView.Drawing.cs (448 lines) - rendering
  - TableView.Mouse.cs (114 lines) - mouse handling
  - TableView.Navigation.cs (159 lines) - navigation
  - TableView.Selection.cs (492 lines) - selection
- Applied ReSharper Full Cleanup and BackingFieldReorderer
- Fixed 15 ReSharper warnings (InvertIf, patterns, switch expressions)
- Reduced warnings from 18 to 2 (both optional style suggestions)
- Updated cleanup-agent.md: clarify CWP TODO comment requirements

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 18:22:25 -07:00
Tig
027aec9dfe Refactor cleanup-agent.md: Claude performs steps manually
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>
2026-01-14 14:43:02 -07:00
Tig
1c9ae3e9a7 Merge pull request #4554 from gui-cs/copilot/select-all-text-on-focus 2026-01-14 12:07:21 -07:00
Tig
d4616eb582 Progress. 2026-01-14 10:00:34 -07:00
Tig
47b9deceae Merge branch 'v2_develop' into copilot/select-all-text-on-focus 2026-01-13 16:52:12 -07:00
Copilot
ad6a20d79b Fixes #3735. Rename GraphView coordinate methods and variables to use viewport terminology (#4557)
* Initial plan

* Add tests for GraphView border rendering

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

* Rename GraphSpaceToScreen/ScreenToGraphSpace to clarify they use viewport coordinates

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

* Fix spelling: CoPilot -> Copilot

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

* Address review feedback: rename variables, remove obsolete methods, fix comments

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

* Refactor graphing axes and series into separate files

Split Axis, ISeries, and related classes into dedicated files for improved modularity and maintainability. Updated property initializers, documentation, and code style throughout. Adjusted GraphViewExample and fixed minor typos. Updated .DotSettings and package files.

* Remove local_packages directory (build artifacts)

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

* Update .gitignore

* added release packages

---------

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>
2026-01-13 16:52:00 -07:00
Tig
3e9f6e328b Increase width of tab controls in TabViewTests
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.
2026-01-13 16:44:51 -07:00
Tig
9101714490 Refactor mouse event handling and test setup
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.
2026-01-13 16:39:29 -07:00
Tig
06bc43c1d1 Merge branch 'v2_develop' into copilot/select-all-text-on-focus 2026-01-13 15:44:25 -07:00
Tig
fe383fbf9d Fix MessageBox not setting SchemeName correctly (#4567) (#4568)
* 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>
2026-01-13 15:41:58 -07:00
Tig
a88055c159 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-13 15:28:33 -07:00
Tig
5bee1c18d5 Improve warning handling: attempt to fix instead of just rollback
- 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>
2026-01-13 15:06:31 -07:00
Tig
e1ce449ff5 Fix warning verification syntax and XML parsing
- 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>
2026-01-13 15:02:22 -07:00
Tig
d2748734e9 Add warning verification to cleanup agent
- 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>
2026-01-13 14:58:15 -07:00
Tig
2524f1a32e Fix cleanup agent to process partial files through full pipeline
- 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>
2026-01-13 14:49:40 -07:00
Tig
a76ed76e7a Update cleanup agent with verified ReSharper CLI usage
- 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>
2026-01-13 14:45:44 -07:00
Tig
f921f8f6b5 Add code cleanup automation agent and Roslyn tools
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.
2026-01-13 14:22:16 -07:00
Tig
2d9e9b547f Merge branch 'v2_develop' into copilot/select-all-text-on-focus 2026-01-13 13:49:13 -07:00
Copilot
23ee30b1be Fix intermittent parallel test hangs on macOS runners (#4570)
* 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>
2026-01-13 13:48:46 -07:00
Tig
0b217e1a85 Merge branch 'v2_develop' into copilot/select-all-text-on-focus 2026-01-13 11:12:10 -07:00
Copilot
3df7daf313 Update template installation commands to use v2 templates (#4560)
* Initial plan

* Update template installation commands to use v2 templates

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

* Move template installation to v2 Develop section

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

* Update template commands to match updated Terminal.Gui.templates

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>
Co-authored-by: Tig <tig@users.noreply.github.com>
2026-01-13 10:48:20 -07:00
Tig
906dfc6e07 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-13 08:40:31 -07:00
Tig
c4e30644d0 Merge branch 'v2_develop' into copilot/select-all-text-on-focus 2026-01-12 23:14:28 -07:00
Tig
f7eda3358a Fix API docs workflow to build Terminal.Gui.dll before docfx (#4566)
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>
2026-01-12 23:04:31 -07:00
Tig
5efbfe1be4 Fixes #4562 - DocFX documentation link warnings (#4564)
* updates

* commiting to avoid crruption

* Fix DocFX documentation link warnings (#4562)

Fixed 197 out of 226 DocFX warnings (87% reduction) by correcting invalid
API documentation links across multiple documentation files.

Changes:
- Fixed namespace issues: Updated links to use correct namespaces
  (Drawing, Input, ViewBase, Views, App, Configuration, Drivers)
- Fixed missing type mappings:
  - RunState → SessionToken
  - IConsoleDriver → IDriver
  - MouseEventArgs → Mouse
- Converted 100+ invalid bookmark-style links to xref format
  - Changed from: [Property](~/api/Class.yml#bookmark)
  - Changed to: <xref:Namespace.Class.Property>
- Fixed generic type format in links (e.g., FlagSelector`1, TreeView`1)
- Fixed nested member links (e.g., Shortcut.Key, MenuBarItem.PopoverMenu)

Files modified:
- docfx/docs/View.md (60+ link fixes)
- docfx/docs/newinv2.md (30+ link fixes)
- docfx/docs/arrangement.md (20+ link fixes)
- docfx/docs/config.md (10+ link fixes)
- docfx/includes/arrangement-lexicon.md (2 link fixes)
- docfx/docs/mouse.md (minor fixes)

Remaining 29 warnings are primarily in views.md (excluded per guidance),
missing image files, and internal document bookmarks.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* removed local packages

* built

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 22:43:32 -07:00
Tig
c015162a45 Refactor ListView: auto-properties, mouse, and selection (#4561)
* 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.
2026-01-12 17:31:28 -07:00
Pascal Sommer
f243db3b96 fix imports in readme example (#4563) 2026-01-12 16:16:27 -07:00
Tig
5ff19d2ec6 testing version info 2026-01-12 12:28:40 -07:00
Tig
6bea533224 Merge branch 'v2_develop' into v2_release 2026-01-12 11:12:49 -07:00
Tig
390e62fb72 Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop 2026-01-12 11:12:11 -07:00
Copilot
1326d7e8d6 Add ConfigLocations.Env and fix load priority order (#4553)
* 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>
2026-01-12 11:10:31 -07:00
Tig
d282dbd24b tweaked .sln 2026-01-12 09:57:20 -07:00
Tig
502714e394 Merge branch 'v2_develop' into v2_release 2026-01-12 09:53:44 -07:00
Tig
7683143492 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-12 09:51:19 -07:00
Copilot
d1f90c107a Fixes #2668. Automate releases (#4556)
* Initial plan

* Add automated release workflow and update documentation

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

* Update release workflow to use gh CLI instead of deprecated action

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

* Fix tag creation order - tag should point to release commit

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

* Improve error messages and release notes formatting in workflow

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

* Fix release notes - package will be published, not has been published

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

* Add updateAssemblyInfo and use env vars for heredoc safety

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

* Revert to original tag-then-commit order for consistency

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

* Delete deprecated Scripts/Release.ps1 file

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>
2026-01-12 09:50:55 -07:00
Tig
7973f853d8 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-12 09:36:20 -07:00
copilot-swe-agent[bot]
9aa9658ebf Implement TextField select all text on keyboard focus
- 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>
2026-01-12 13:59:36 +00:00
copilot-swe-agent[bot]
9d5921fabf Initial plan 2026-01-12 13:35:48 +00:00
Tig
bbcc764a32 Fixes #4551 - Upgrade to .NET 10 and C# 14 (#4552) 2026-01-12 06:21:01 -07:00
Tig
57d54447dd Fixes #4549 - Restore focus indicator visibility in Arrangement mode (#4550)
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>
2026-01-11 21:00:27 -07:00
Tig
d36768c00d Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-11 20:01:07 -07:00
Tig
cc8ff633fa Fixes #4417 - Updates UI Catalog & Scenarios to instance-based app model (#4547)
* 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>
2026-01-11 19:58:15 -07:00
Tig
e3f73a49a5 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-11 01:17:51 -07:00
Tig
46208c004f Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2026-01-10 15:32:34 -07:00