- Added detailed comments explaining the fix has two parts
- Part 1: Set ForceDriver in RuntimeConfig (in UICatalogMain)
- Part 2: Reload RuntimeConfig before each scenario (in scenario loop)
- Tests simulate both parts and verify driver persists
- Added note that commenting out the reload causes the test to fail, demonstrating the bug
Co-authored-by: tig <585482+tig@users.noreply.github.com>
- Tests now use UICatalogTop and call scenario.Main()
- First test simulates full UICatalog flow: run UICatalogTop, select scenario, run scenario
- Second test runs multiple scenarios in sequence to verify driver persistence
- Both tests properly clean up event handlers to avoid assertions
- Tests verify the fix works correctly by actually running scenarios
Co-authored-by: tig <585482+tig@users.noreply.github.com>
- Created ForceDriverTests.cs with two integration tests
- Tests verify ForceDriver persists across Init/Shutdown cycles
- Tests verify scenarios use ForceDriver when calling Application.Init()
- Both tests pass successfully
Co-authored-by: tig <585482+tig@users.noreply.github.com>
- Set ForceDriver directly when ConfigurationManager is not enabled
- Ensures benchmarks work correctly with --driver option
Co-authored-by: tig <585482+tig@users.noreply.github.com>
- Set ForceDriver in ConfigurationManager.RuntimeConfig instead of directly on Application.ForceDriver
- Reload RuntimeConfig before each scenario to ensure driver persists
- Remove redundant Application.ForceDriver assignment in RunScenario
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor selectors and improve UI components
Refactored `MarginEditor` and `UICatalogTop` to use new `OptionSelector` and `FlagSelector` classes, introducing type-safe generic versions for better flexibility and maintainability. Added `SelectorBase` as a shared foundation for these components, along with the `SelectorStyles` enum for customizable styles.
Enhanced unit tests to cover new implementations and edge cases. Enabled nullable reference types for improved null safety. Improved code readability, reduced redundancy, and enhanced user experience with better hotkey management, focus handling, and layout adjustments.
* Refactor UI components and remove unused classes
Significant refactoring and simplification of the codebase:
- Updated `CharacterMap` to use `OptionSelector<UnicodeCategory>`.
- Removed `FlagSelector`, `FlagSelector<TEnum>`, and `FlagSelectorStyles`.
- Replaced `OptionSelector.Options` with `Labels` in `MenuBarv2`.
- Removed `OptionSelector` and its associated properties/methods.
- Updated terminology from "Activate" to "Select" across components.
- Refactored `SelectorBase` to align with new "Select" behavior.
- Removed redundant methods, properties, and event handlers.
These changes streamline the codebase, reduce complexity, and align with updated design principles.
* Fixes#4374 - 'Application.Screen' is empty when 'Init' returns
Refactor and enhance testability of ApplicationImpl
Refactored `ApplicationImpl` and related classes to improve modularity and testability. Replaced `FakeConsoleOutput` with `FakeOutput` and introduced `FakeInput` for better test isolation. Added platform-specific factories (`FakeNetComponentFactory`, `FakeWindowsComponentFactory`) to simplify fake component creation.
Refactored `GuiTestContext` into partial classes, adding methods for simulating user interactions and improving initialization logic. Enhanced error handling and logging during test setup.
Updated tests to use the new `FakeOutput` and `FakeInput` implementations. Standardized driver initialization with `Application.Init(null, "fake")`. Skipped tests relying on the fake driver due to known issues.
Performed general cleanup, modernized syntax, and removed redundant code to improve readability and maintainability.
* Disable "windows" test case in SynchronizationContextTests
The `InlineData("windows")` attribute in the
`SynchronizationContext_Post` test method has been commented out.
This change temporarily excludes the `"windows"` driverName from
the test suite while retaining other test cases (`"fake"`,
`"dotnet"`, and `"unix"`). The exclusion may be for debugging,
deprecation, or other maintenance purposes.
* Disable "windows" test case in SynchronizationContextTests
The `[InlineData("windows")]` attribute in the
`SynchronizationContextTests` class has been commented out,
disabling the test case for the `"windows"` driver name.
This change may have been made for debugging, deprecation, or
because the test is no longer relevant. Other test cases
(`"fake"`, `"dotnet"`, and `"unix"`) remain active.
* Update Terminal.Gui/Drivers/FakeDriver/FakeConsole.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/SelectorStyles.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/SelectorBase.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/OptionSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/OptionSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/OptionSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/SelectorBase.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Backported Checkbox from Activate PR
* Backported Checkbox from Activate PR 2
* Backported Checkbox from Activate PR 3
* Backported Selctors Scenario
* Backported Bars Scenario
* Backported AllViewsTester Scenario
* Backported Dialogs Scenario
* Backported MessageBoxes Scenario
* Backported ArrangementEditor
* Backported mouse binding fix
* Update Terminal.Gui/Views/Selectors/OptionSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Drivers/WindowsDriver/WindowsOutput.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/CheckBox.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fixed typo
* Refactor ArrangementEditor event handling
Removed the `ArrangementFlagsOnValueChanged` method, which previously handled updates to `ViewToEdit` properties based on arrangement flags. Updated `ArrangementEditor_Initialized` to attach the event handler to `_arrangementSelector.ValueChanged`. The logic for handling arrangement changes has been refactored or relocated.
* Refactor AlignKeys for type safety and readability
Updated the `AlignKeys` method in the `Shortcuts` class to replace generic `View` references with the more specific `Shortcut` type. Improved type safety by using `IEnumerable<Shortcut>` and `.Cast<Shortcut>()`. Simplified the `max` calculation logic with a single LINQ query and removed redundant casting in the `foreach` loop. These changes enhance code readability, maintainability, and ensure better type safety.
* Refactor ArrangementEditor for clarity and consistency
Refactored `ArrangementEditor` to improve code readability and maintainability:
- Enabled nullable reference types with `#nullable enable`.
- Removed unused `using` directives.
- Adjusted namespace declaration for formatting consistency.
- Reformatted `_arrangementSelector` initialization and property assignment.
- Simplified `OnViewToEditChanged` logic with a ternary expression.
- Refactored `ArrangementEditor_Initialized` into a single-line block.
* Update Examples/UICatalog/Scenarios/Shortcuts.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/Selectors/OptionSelector.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor and enhance OptionSelector and SelectorBase
Refactored `OptionSelector` and `SelectorBase` to simplify logic, improve hotkey assignment, and ensure robust behavior. Updated `Shortcuts.cs` and `DialogTests.cs` to address nullability issues.
Added comprehensive unit tests for `OptionSelector` and `SelectorBase`, covering properties, methods, edge cases, and layout behaviors. These changes improve code readability, maintainability, and functionality while adhering to modern C# practices.
* add FlagSelector comprehensive tests
Refactored `UncheckNone` and `UncheckAll` methods in `FlagSelector` to improve clarity and prevent concurrent modifications using a new `_updatingChecked` flag. Removed the old `UncheckNone` implementation and reorganized logic for maintainability.
Added extensive unit tests in `FlagSelectorTests` to validate functionality, including edge cases and generic implementations. Tests cover flag combination, toggling, "None" flag behavior, and enum-based generic handling.
Improved overall maintainability and test coverage for the `FlagSelector` class.
* Fixes#4375. UnixDriver fails Toplevel_TabGroup_Forward_Backward Fluent Tests
* Refactor RadioGroup to use OptionSelector
The `RadioGroup` class has been refactored to inherit from the `OptionSelector` class instead of `View`, marking it as `[Obsolete]` and recommending the use of `OptionSelector`.
The previous implementation of `RadioGroup` has been entirely removed, including its properties, methods, events, and internal logic. This includes initialization logic, key bindings, layout management, and event handling.
The new `RadioGroup` is now a thin wrapper around `OptionSelector` and implements the `IDesignable` interface. The `EnableForDesign` method has been simplified to set default options for design purposes.
This change simplifies the codebase and encourages the use of `OptionSelector` for managing mutually exclusive options.
* Backported focus tests and add bug-exposing test case
Refactored `AdvanceFocusTests` to improve assertion clarity by replacing `Assert.True`/`Assert.False` with `Assert.Equal`. Enhanced test documentation with detailed view hierarchy comments for better readability.
Added a new test case, `FocusNavigation_Should_Cycle_Back_To_Top_Level_Views`, which exposes a bug in focus navigation logic where focus does not cycle back to top-level views after traversing nested views.
Updated existing tests to ensure consistent handling of `TabBehavior` and made minor adjustments for improved validation of focus navigation logic.
* Remove all tests for RadioGroup component
The `RadioGroupTests.cs` file has been completely cleared of all test cases and associated code. This includes the removal of unit tests that validated the `RadioGroup` component's functionality, behavior, and edge cases.
The deleted tests covered:
- Default constructor behavior and initialization.
- Handling of the `SelectedItem` property, including edge cases.
- Hotkey bindings and their behavior under different focus states.
- Command handling for focus, selection, and acceptance.
- Orientation changes and their impact on layout.
- Event handling for `SelectedItemChanged`, `Selecting`, and `Accepting`.
- Mouse interactions, including single-click and double-click events.
This removal eliminates all automated validation for the `RadioGroup` component, leaving it untested and increasing the risk of regressions or undetected issues in future changes.
* Fix unix and fake fluent tests.
* More fixes for unix and fake drivers
* Change classes names for more consistency
* Fix typos in docs and method signature
Updated XML documentation in `FakeConsole.cs` to replace `<see cref="FakeDriver"/>` with `<exception cref="FakeDriver"></exception>` for clarity.
Corrected a parameter name in `WindowsOutput.cs`'s `WriteConsole` method from `numberOfCharsToWritten` to `numberOfCharsToWrite` to fix a typo and improve readability.
* Refactor: Replace RadioGroup with OptionSelector
Replaced all instances of `RadioGroup` with `OptionSelector` across the codebase to standardize the control for mutually exclusive options. Updated associated properties, methods, and event handlers to align with the `OptionSelector` API, including replacing `RadioLabels` with `AssignHotKeys` and `SelectedItemChanged` with `ValueChanged`.
Removed the `RadioGroup` class, marking it as obsolete. Updated documentation, comments, and test cases to reflect the new control. Adjusted layout and positioning logic in various scenarios to ensure UI consistency.
Refactored scenarios such as `Buttons`, `ColorPickers`, `DynamicMenuBar`, `FileDialogExamples`, `Images`, `PosAlignDemo`, `ProgressBarStyles`, `RegionScenario`, `Themes`, and others to use `OptionSelector`. Updated `Glyphs` and `View` classes to reflect the terminology change. Cleaned up redundant code and ensured compatibility across the application.
* Refactor OptionSelector to use Value instead of SelectedItem
Replaced the SelectedItem property with a nullable Value property across the codebase to simplify the API and improve consistency. Updated event handlers from SelectedItemChanged to ValueChanged and adjusted logic accordingly.
Refactored UI scenarios (e.g., Buttons, CharacterMap, ColorPickers) and dependent classes (e.g., BorderEditor, DimEditor, PosEditor) to use the new Value property. Improved null handling and streamlined initialization of controls.
Updated tests to validate the Value property and renamed test methods for clarity. Removed the RegionOpSelector class as it was no longer needed. Performed general code cleanup, including formatting and removal of redundant code.
* Refactor OptionSelector: Replace RadioLabels with Labels
Updated the `OptionSelector` class and its derived classes to replace the `RadioLabels` property with a more generic `Labels` property, aligning with the base class `SelectorBase`. This change standardizes the API and simplifies label-related functionality.
Refactored all instances of `RadioLabels` across the codebase, including property assignments, method calls, and references in scenarios, tests, and examples. Updated classes include `ColorPickers`, `Dialogs`, `DimAutoDemo`, `DynamicMenuBar`, `FileDialogExamples`, `Images`, `PosAlignDemo`, `Selectors`, `Shortcuts`, `TextAlignmentAndDirection`, `Themes`, `UnicodeInMenu`, `Wizards`, `UICatalogTop`, and `ScenarioTests`.
Modified `OptionSelector<TEnum>` to initialize `Labels` directly using `Enum.GetValues<TEnum>()`. Removed the `RadioLabels` property from `OptionSelector`, consolidating functionality under `Labels`.
Verified functionality through updated tests and scenarios to ensure consistent behavior with the previous implementation.
* Refactor: Replace "radio group" with "option selector"
Updated terminology across multiple classes to replace "radio group" with "option selector" for improved clarity and consistency.
- Removed unused `OptionSelector` in `ColorPickers`.
- Renamed `Title` in `DimAutoDemo` to "Options" and updated `BorderStyle`.
- Replaced `_radioItems` with `_optionLabels` in `DimEditor` and `PosEditor`.
- Renamed `styleRadioGroup` to `styleOptionSelector` in `MessageBoxes`.
- Renamed `radioGroup` to `optionSelector` in `UnicodeInMenu` and `OrientationTests`.
- Adjusted related references, event handlers, and UI properties.
These changes align the codebase with updated terminology and improve readability.
* Replace RadioGroup with OptionSelector and update docs
The `RadioGroup` control has been replaced or renamed to `OptionSelector`. Documentation has been updated to reflect this change, including the behavior of raising the `Selecting` event when an option is selected.
The navigation table now describes `OptionSelector` as supporting multiple options with actions like `Advance`, `SetValue+OnAccept`, and `Focus+SetValue`. A new section introduces the `OptionSelector` view, which displays mutually-exclusive items with hotkeys.
Enhancements to `Menuv2` and `MenuBarv2` include setting focus on `MenuItemv2` selections and raising the `SelectedMenuItemChanged` event. Additionally, a progress bar view has been introduced to visually indicate activity progress.
* Fixed `EndAfterFirstIteration`
Renamed the `EndAfterFirstIteration` property to `StopAfterFirstIteration` across the codebase for improved clarity and consistency. Updated all references in the `Application`, `ApplicationImpl`, `IApplication`, and `ITimedEvents` classes, as well as related tests and documentation.
Modified the application loop logic to use `StopAfterFirstIteration` for controlling the termination of the application after the first iteration. Set its default value to `false`.
Updated test cases, demo applications, and XML documentation to reflect the new property name. Added a new project, `OutputView`, to the solution with appropriate configuration entries.
Performed minor code cleanup to ensure consistency in naming and behavior.
* Enhance selectors and clean up documentation
- Added `args.Handled = true` to `CheckBox` event handlers in `FlagSelector` and `OptionSelector` to mark events as handled.
- Introduced `_value` field in `FlagSelector` and added a `Cycle` method in `OptionSelector` for better value management.
- Updated `OptionSelector` documentation to reference `OptionSelector<TEnum>` for type-safe enum usage.
- Improved `UpdateChecked` method documentation in `OptionSelector` to clarify exception behavior.
- Enabled nullable reference types in `FlagSelectorTests` and `SelectorBaseTests` and moved them to a new namespace.
- Removed outdated auto-generated content from `views.md`.
- Removed `CheckBox.DefaultHighlightStyle` from the default theme configuration in `OutputView.cs`.
* Update event handling and expand UI documentation
Modified `args.Handled` in `FlagSelector` and `OptionSelector` to allow `Accepting` event propagation, improving event handling behavior. Added comments to clarify the changes.
Expanded `views.md` with detailed documentation for built-in views and controls in *Terminal.Gui*, including descriptions, examples, and rendered outputs for components like `Bar`, `Button`, `CheckBox`, and more. This update enhances developer guidance for building terminal-based UIs.
* Fixed `EndAfterFirstIteration` in `ApplicationImpl`
Renamed the `EndAfterFirstIteration` property to `StopAfterFirstIteration` across the codebase for improved clarity. Updated its implementation to use a getter and setter that interact with the `ApplicationImpl.Instance` singleton for centralized management.
Modified the `RunLoop` method to check the new `StopAfterFirstIteration` property. Updated the default value to `false` in the `Application` class.
Added a private `_stopAfterFirstIteration` field and a corresponding public property in the `ApplicationImpl` class. Updated the `Run` method in `ApplicationImpl` to stop after the first iteration if the property is set to `true`, with appropriate logging.
Updated the `IApplication` interface to include the `StopAfterFirstIteration` property and clarified the behavior of the `RequestStop` method. Revised XML documentation comments to reflect these changes.
* Fixed EndfterFirstIteration in ApplicaitonImpl
Refactored `StopAfterFirstIteration` in `ApplicationImpl` to use an auto-property for simplicity. Updated `RunIteration` to call `view.RequestStop()` instead of modifying `view.Running`.
Replaced references to `Application.EndAfterFirstIteration` with `Application.StopAfterFirstIteration` across the codebase, including `ITimedEvents`, `ApplicationTests`, and `GlobalTestSetup`.
Added a new test, `InitRunShutdown_StopAfterFirstIteration_Stops`, to verify the application stops correctly after the first iteration. Updated related documentation and assertions for consistency.
* Refactor Value handling and improve type safety
Refactored `Value` handling across multiple classes to use nullable generic types, improving type safety and eliminating unnecessary casting. Simplified `ValueChanged` event handlers with concise lambda expressions.
Enhanced `FlagSelector<TFlagsEnum>` and `OptionSelector<TEnum>` with generic `ValueChanged` events and type-safe event handling. Added nullable reference type annotations to align with modern C# practices.
Improved test code by using null-forgiving operators and more descriptive assertions. Cleaned up redundant code and ensured consistency in `Value` handling. Updated `FlagSelectorTests` and `SelectorBaseTests` for better readability and maintainability.
Added the `System` namespace to `FlagSelectorTEnum.cs` for compatibility. Overall, these changes enhance code readability, maintainability, and robustness.
* Merged v2_develop
* Update README badges for v2_develop branch
Updated the `.NET Core` badge to reference the `v2_develop` branch. Adjusted the `codecov` badge to remove branch-specific paths and added a token parameter. Reorganized the `codecov` badge position in the README. Retained other badges without modification.
* codcov2
* fixed pos tests
* Improve cleanup, coverage config, and SpinnerStyle tests
Enhanced resource cleanup in `Pos.CombineTests.cs` by disposing of `Application.Top` to prevent leaks. Updated `codecov.yml` to focus coverage on `Terminal.Gui`, simplified path patterns, and clarified configurations.
Added `SpinnerStyleTests` with extensive unit tests for `SpinnerStyle` and its variants, covering default properties, behaviors, edge cases, and immutability. Organized tests for readability and ensured thorough validation of all spinner styles. Enabled nullable reference types for improved safety.
* Remove .NET Core badge; add comprehensive boundary tests
The `.NET Core` workflow badge was removed from the `README.md` file.
Added a comprehensive suite of unit tests for the `Region.DrawOuterBoundary` method in `DrawOuterBoundaryTests.cs`. These tests validate the method's behavior across various scenarios, including:
- Intersected, unioned, and complex shapes.
- Edge cases like empty regions, zero-width/height rectangles, and single-pixel rectangles.
- Specific shapes such as L-shaped, T-shaped, and hollow rectangles.
- Overlapping, adjacent, and separate rectangles.
- Thread safety with parallel drawing.
- Different line styles, custom attributes, and very large regions.
- Various positions, sizes, and multiple calls on the same canvas.
The tests use the `Xunit` framework and include both `[Fact]` and `[Theory]` test cases. These changes enhance the codebase's robustness and ensure correctness in a wide range of scenarios.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: BDisp <bd.bdisp@gmail.com>
Refactored `GenerateMethods` to replace LINQ with explicit loops, improving readability and maintainability. Added support for `notnull` and `new()` constraints and ensured constraint clauses are only added when necessary.
Streamlined `switch` statements for `RefKind` modifiers and default parameter values to use more compact syntax. Updated exception message formatting for clarity. Commented out unused "Throws" method generation.
Removed an extraneous closing brace for cleanup.
Updated the `.NET Core` badge to reference the `v2_develop` branch.
Revised the `codecov` badge to remove branch-specific paths and
added a token parameter. Adjusted badge placement for better
alignment and included additional badges for `Downloads`,
`License`, and `Bugs`.
* Refactor newinv2.md deep dive doc
Terminal.Gui v2 introduces a transformative redesign, simplifying the library's architecture and improving maintainability. Key changes include:
- Added TrueColor support with 24-bit RGB handling.
- Introduced `Adornment` framework for borders, padding, and margins.
- Enhanced Unicode and wide character support for internationalization.
- Added `LineCanvas` for drawing lines and shapes with box-drawing characters.
- Simplified API by consolidating redundant methods and aligning with modern .NET standards.
- Introduced `ConfigurationManager` for user-customizable themes and text styles.
- Improved scrolling with `Viewport` and integrated `ScrollBar`.
- Added new layout features like `Dim.Auto`, `Pos.AnchorEnd`, and `Pos.Align`.
- Overhauled keyboard and mouse APIs for better input handling.
- Introduced new views (e.g., `DatePicker`, `ColorPicker`, `GraphView`) and enhanced existing ones.
- Added Sixel image support for rendering graphics in compatible terminals.
- Ensured AOT compatibility for improved deployment and performance.
This update lays the foundation for building modern, user-friendly terminal applications.
* Fixes#4368 - Clarify and Fix CWPPropertyHelper Property Change Workflow
Refactor ChangeProperty method for clarity and flexibility
Updated the `<param>` documentation for `currentValue` to clarify its behavior. Changed the `currentValue` parameter to be passed by reference (`ref`) to allow direct updates to the caller's variable. Made the `onChanging` delegate nullable and added a null check to prevent potential exceptions. Moved the `cancelled` variable inside the null-check block for `onChanging` to simplify logic. Explicitly updated `currentValue` to `finalValue` after the `doWork` action to ensure consistency. These changes improve the method's robustness, flexibility, and clarity.
* Refactor ChangeProperty calls to use ref parameters
Updated `CWPPropertyHelper.ChangeProperty` calls in `View.Drawing.Scheme.cs` and `View.Layout.cs` to pass fields as `ref` parameters. This ensures direct modification of fields, improving property update handling.
Affected properties:
- `_schemeName` and `_scheme` in `View.Drawing.Scheme.cs`
- `_height` and `_width` in `View.Layout.cs`
Property change notification logic remains unchanged. This refactor enhances maintainability and correctness without introducing new functionality.
Refactor ChangeProperty method for clarity and flexibility
Updated the `<param>` documentation for `currentValue` to clarify its behavior. Changed the `currentValue` parameter to be passed by reference (`ref`) to allow direct updates to the caller's variable. Made the `onChanging` delegate nullable and added a null check to prevent potential exceptions. Moved the `cancelled` variable inside the null-check block for `onChanging` to simplify logic. Explicitly updated `currentValue` to `finalValue` after the `doWork` action to ensure consistency. These changes improve the method's robustness, flexibility, and clarity.
* Initial plan
* Add ScreenChanged event, SetScreenSize method, and fix FakeDriver buffer initialization
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add comprehensive tests for ScreenChanged event and buffer integrity
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Replace obsolete SizeChanged usage with ScreenChanged in core and tests
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor terminal size event handling
Replaced `ScreenChanged` with `SizeChanged` across the codebase to standardize naming and improve clarity. Updated event handling logic, including subscriptions, unsubscriptions, and raising methods. Removed deprecated `ScreenChanged` event and backward compatibility code.
Refactored driver initialization to handle legacy `IConsoleDriver` types separately. Updated tests and mock implementations to align with the new `SizeChanged` event. Improved documentation and comments to reflect these changes.
These updates enhance maintainability, consistency, and modernize the architecture.
* Refactor & Code Cleanup: Replace IWindowSizeMonitor with IConsoleSizeMonitor
Renamed `IWindowSizeMonitor` to `IConsoleSizeMonitor` across the codebase, updating all references, method signatures, and event handlers. Replaced the `WindowSizeMonitor` class with the new `ConsoleSizeMonitor` implementation, which includes improved terminal size change handling via the `Poll` method.
Enabled nullable reference types in several files to enhance code safety. Updated test cases to reflect the new `IConsoleSizeMonitor` interface. Removed redundant code, simplified null checks, and corrected minor typos in comments. Streamlined the codebase by removing the obsolete `WindowSizeMonitor` class and its interface.
* Code cleanup - Refactor and enhance ShadowView and FakeDriverTests
Updated ShadowView.cs to use null-conditional operators and added null checks for safer access to `ScreenContents`. Refined XML documentation in View.Layout.cs for clarity and consistency.
Refactored FakeDriverTests.cs to leverage modern C# features, including shorthand object instantiation, inline lambdas, and tuple-like syntax for `Size` and `Rectangle`. Removed redundant tests and improved test readability and reliability.
Enhanced error handling with null checks and ensured backward compatibility for deprecated events. Improved test coverage for resizing, clipboard operations, and invalid coordinates. Verified buffer integrity and screen updates after resizing.
General improvements include replacing explicit type declarations with `var`, removing unused imports, and aligning code formatting for better readability.
Refactor and improve code quality and test coverage
Updated `ShadowView` for null safety using null-conditional operators. Simplified object initializations and modernized syntax across the codebase, including shorthand initializations and inline lambdas. Enhanced event handling logic and ensured compatibility with obsolete members.
Refactored `FakeDriverTests` by removing redundant code, standardizing formatting, and improving test setup. Suppressed obsolete warnings where necessary. Improved XML documentation in `View.Layout.cs` for clarity and removed outdated references.
Performed general cleanup, including removing unused namespaces, redundant comments, and ensuring consistent formatting. These changes enhance readability, maintainability, and runtime safety.
* Code cleanup
Refactor TimedEventsTests for readability and consistency
Improved code readability and maintainability:
- Enabled nullable reference types with `#nullable enable`.
- Removed unused `using System.Diagnostics;`.
- Updated namespace to `UnitTests.ApplicationTests`.
- Replaced `Terminal.Gui.App.TimedEvents` with `TimedEvents`.
- Reformatted XML documentation comments for alignment.
- Used `var` and target-typed new expressions for consistency.
- Reformatted `Parallel.For` loops and lambdas for clarity.
- Added `Thread.Sleep(10)` to prevent excessive CPU usage in tests.
- Improved assertions and event handler formatting in tests.
Aligned with modern C# coding practices.
* Code Cleanup - No more driver warnings.
Refactor codebase and introduce FakeClipboard
- Adjusted `.editorconfig` to change severity levels for CS0612, CS0618, and CS0672 diagnostics.
- Replaced `FakeDriver.FakeClipboard` with a new `FakeClipboard` class for testing purposes, supporting exception handling and clipboard data manipulation.
- Removed redundant methods (`MakeColor`, `MapKey`) and unused classes (`MockConsoleDriver`) to streamline the codebase.
- Refactored `ConsoleDriverFacade` and `FakeDriver` to simplify logic and improve maintainability.
- Updated tests to use `CreateFakeDriver` and removed or commented out obsolete tests.
- Reformatted and cleaned up code for readability across multiple files.
* Refactor FakeDriver - Code Cleanup
Standardized console size management by replacing `WindowSizeMonitor` with `ConsoleSizeMonitor` across the codebase. Updated methods `GetWindowSize` and `SetWindowSize` to `GetSize` and `SetSize` for consistency.
Refactored `FakeDriver` to use `SetScreenSize` and removed redundant methods. Simplified driver initialization by removing legacy `InternalInit` logic.
Standardized ANSI escape sequences by replacing `CSI_ReportTerminalSizeInChars` with `CSI_ReportWindowSizeInChars`.
Updated test cases to align with the new `ConsoleSizeMonitor` and `SetScreenSize` methods. Removed obsolete test utilities like `FakeSizeMonitor` and `FakeWindowSizeMonitor`.
Performed general code cleanup, including removing unused classes, redundant code, and improving formatting. Fixed resizing logic issues and improved exception handling in driver methods.
* Update Terminal.Gui/Drivers/OutputBuffer.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Drivers/MouseButtonStateEx.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/App/MainLoop/IApplicationMainLoop.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Tests/UnitTests/Views/ToplevelTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/ViewBase/View.Layout.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Moved all Drawing tests to Paralleizable - proving Fakedriver works
Enhanced `Ruler` and `Thickness` classes by adding an optional `IConsoleDriver? driver` parameter to decouple rendering from the default `Application.Driver`, improving flexibility and testability. Updated `DriverAssert` to support nullable drivers and added defensive checks.
Refactored and expanded test cases for `Ruler`, `Thickness`, `LineCanvas`, and `StraightLineExtensions` to ensure comprehensive coverage, including zero-length intersections, line rendering, and exclusion logic. Migrated rendering-dependent tests to a parallelizable namespace.
Removed redundant tests, improved naming conventions, and updated documentation for better maintainability and clarity.
* Fixed Run<T> startup hang.
Refactor: Simplify driver logic and update SetSize methods
Removed FakeDriver safeguard in unit tests to simplify
CreateDriver logic. Updated SetSize methods in NetOutput,
UnixOutput, and WindowsOutput to do nothing instead of
throwing NotImplementedException. Modified SizeChanged
event in ConsoleDriverFacade to call SetScreenSize directly.
Commented out unnecessary debug validation in DimAuto.
These changes improve maintainability and reduce complexity.
* Fixed intermittent unit test bug.
Refactored `_cachedRunStateToplevel` to `CachedRunStateToplevel` as an internal static property, delegating its management to `ApplicationImpl` for improved encapsulation. Updated all references to use the new property and centralized its handling in `ApplicationImpl`.
Removed the `MouseGrabHandler` property from `ApplicationImpl` and simplified driver-related assignments by replacing `Application.ForceDriver` and `Application.Screen` with direct references.
Reset `CachedRunStateToplevel` during cleanup to ensure proper state management. Updated the `Invoke` method to use `Top` directly, aligning with the refactored design. Improved debug assertions and performed general cleanup to enhance code readability and maintainability.
* Fixed intermittent bug an massive code cleanup of warnings.
Refactor and enhance codebase for maintainability
- Applied null-conditional operator (`!`) to improve null-safety.
- Refactored tests for clarity, added new cases, and removed redundancies.
- Introduced `FakeApplicationFactory` and `FakeSizeMonitor` for testing.
- Removed unused code, including legacy `DecodeEscSeq` logic.
- Reformatted code for readability and consistency.
- Updated assertions for more accurate validation in tests.
- Fixed potential null reference issues across multiple files.
- Improved event handling with proper null checks.
- Enhanced documentation for new classes and methods.
- Modernized code with C# features like `record struct` and `nullable enable`.
---------
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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan
* Initial exploration - understanding TextField Caption and Title
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Remove TextField.Caption and use Title instead with hotkey support
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add defensive check to ensure TitleTextFormatter.Text is set
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Final changes - all tests passing
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fixed bugs.
* Add comprehensive tests for caption rendering with attributes validation
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix: Disable TextField hotkey functionality to prevent input interception
TextField's Title is used as a caption/placeholder, not for hotkey
navigation. Hotkey visual formatting (underline) is still rendered
in the caption, but hotkey functionality is disabled to prevent
keys like 'E' and 'F' from being intercepted when typing in the field.
Updated test to expect "_Find" instead of "Find" to match resource change.
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix: Support Alt+key hotkey navigation while allowing normal typing
Override AddKeyBindingsForHotKey to only bind Alt+key combinations
(e.g., Alt+F for "_Find"), not the bare keys. This allows:
- Alt+F to navigate to the TextField with Title="_Find"
- Normal typing of 'F', 'E', etc. without interception
Previously, both bare key and Alt+key were bound, causing typing
issues. Now TextField properly supports hotkey navigation without
interfering with text input.
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Changes before error encountered
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor hotkey handling to support command context
Refactored `RaiseHandlingHotKey` to accept an `ICommandContext? ctx` parameter, enabling context-aware hotkey handling. Updated `Command.HotKey` definitions across multiple classes (`View`, `CheckBox`, `Label`, `MenuBarv2`, `RadioGroup`, `TextField`) to utilize the new context parameter.
Enhanced XML documentation for `RaiseHandlingHotKey` to clarify its usage and return values. Added a context-aware hotkey handler to `TextField` with additional logic for focus handling.
Refactored attribute initialization and improved code readability in `TextField` by aligning parameters and removing unused `HotKeySpecifier` initialization. These changes improve flexibility, maintainability, and consistency across the codebase.
* Remove TextField.Caption property; use Title with hotkey navigation support
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>
* Initial plan
* Enable VT processing in WindowsOutput to support hyperlink detection
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Address code review feedback - track VT enablement and add error handling
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Revert VT processing changes - investigating actual root cause
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Implement OSC 8 hyperlink support in Attribute and OutputBase
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Implement automatic URL detection with OSC 8 at driver level
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix OSC 8 URL wrapping to handle ANSI escape sequences properly
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update newinv2.md
Terminal.Gui v2 introduces a reimagined architecture, removing redundant and overly complex code from v1. Key changes include:
- Added TrueColor support with 24-bit RGB handling.
- Introduced modular adornments framework (Margin, Border, Padding).
- Enhanced Unicode and wide character support for internationalization.
- Simplified API with centralized navigation and modern .NET standards.
- Added built-in scrolling via `Viewport` and improved `ScrollBar`.
- Introduced new views (Bar, CharMap, ColorPicker, etc.) and enhanced existing ones.
- Added `ConfigurationManager` for customizable themes and settings.
- Improved visual fidelity with `LineCanvas`, gradients, and borders.
- Introduced logging, metrics, and Sixel image support.
- Enhanced keyboard and mouse APIs for better interaction handling.
- Ensured AOT compatibility for simplified deployment.
These changes modernize the library, improve usability, and expand its capabilities for terminal-based applications.
* Remove automatic URL detection - reverting to clean state
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Revamp View.md documentation for clarity and depth
Comprehensively restructured and enhanced the `View.md` documentation for the `Terminal.Gui` library to improve usability and completeness.
- Added a Table of Contents for easier navigation.
- Rewrote the "View Hierarchy" section to clarify terminology and key properties, with links to relevant API references.
- Expanded "View Composition" and "Core Concepts" sections with detailed explanations of layers, adornments, and scrolling.
- Detailed the "View Lifecycle" with step-by-step processes and code examples for initialization, layout, drawing, input handling, and disposal.
- Reorganized and expanded the "Subsystems" section, covering commands, input handling, layout, drawing, navigation, and scrolling.
- Updated the "Modal Views" section with examples for dialogs, wizards, and modal view types.
- Introduced a "Common View Patterns" section with practical examples for creating custom views, adding subviews, and implementing scrolling.
- Added an "Advanced Topics" section covering diagnostics, view states, and shadow effects.
- Included numerous inline code examples to illustrate key concepts.
- Concluded with a "See Also" section linking to related deep-dive documentation.
These changes significantly improve the structure, clarity, and accessibility of the documentation, making it easier for developers to understand and use the library effectively.
* Restore working automatic URL detection with fix for URLs containing ANSI sequences
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix URL regex to handle underscores and trailing punctuation + add comprehensive tests
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update and expand Configuration Management documentation
The document title was updated to "Configuration Management Deep Dive" to reflect its expanded scope. A new Table of Contents was added for improved navigation. The introduction and "Overview" sections were rewritten to provide a clearer explanation of the `ConfigurationManager` class and its key features.
New sections were added, including "Getting Started," "Themes and Schemes," "Defining Configuration Properties," "Events," and "Best Practices." These sections provide detailed explanations, examples, and recommendations for using the `ConfigurationManager` effectively.
The "Configuration Scopes" and "Configuration Locations and Precedence" sections were restructured and expanded with detailed explanations, diagrams, and examples. Advanced topics such as JSON error handling, runtime configuration, and file system watching were introduced.
The document now includes several new examples, such as theme switching and custom application settings, along with references to related topics and UICatalog examples. The content was reorganized for clarity, with redundant sections removed.
* Refactor and expand Arrangement system documentation
Updated the title to "View Arrangement Deep Dive" and added a Table of Contents for better navigation. Expanded the "Overview" section and restructured "Arrangement Modes" with detailed examples. Added new sections for "Arrange Mode (Interactive)," "Movable Views," "Resizable Views," and "Creating Resizable Splitters," with practical code samples.
Enhanced "Tiled vs Overlapped Layouts" and "Modal Views" sections, and introduced "Runnable Views" to explain non-modal behavior. Expanded the "Examples" section with multiple use cases and added advanced topics like Z-order management and arrangement events.
Updated `arrangement-lexicon.md` with API links for key terms. Improved formatting and consistency throughout the document to enhance clarity and usability.
* Update CONTRIBUTING.md references and add critical note
Updated the reference to `CONTRIBUTING.md` to use a relative
path (`../CONTRIBUTING.md`) for accurate resolution. Enhanced
instructions for AI agents, including CoPilot and Cursor, to
strictly follow the updated guidelines. Added a **CRITICAL**
note requiring CoPilot to internalize and adhere to the
guidelines, including when operating in Agent mode.
* Refactor URL handling and add OSC 8 hyperlink support
Replaced `UrlRegex` with the new `Osc8UrlLinker` utility to handle URL detection and wrapping with OSC 8 hyperlink sequences, improving modularity and maintainability. Updated `OutputBase` to use `Osc8UrlLinker.WrapOsc8` for URL processing and removed legacy `WrapUrlsWithHyperlinks` logic.
Added the `Osc8UrlLinker` class with robust URL parsing, support for allowed schemes, and handling of edge cases like trailing punctuation and ANSI escape sequences. Improved performance with efficient `StringBuilder` usage.
Enhanced `AnimationScenario` to ensure URLs with underscores are drawn correctly. Improved code readability by renaming constants, simplifying nullable handling, and updating documentation.
Replaced legacy `UrlDetectionTests` with `Osc8UrlLinkerTests`, covering standalone URLs, URLs in text, multiple URLs, and edge cases. Verified hyperlink wrapping correctness and visible content integrity.
Updated `Terminal.sln.ToDo.DotSettings` to disable auto-opening of the Stack Trace Explorer. Cleaned up unused code, enabled nullable reference types, and improved XML documentation formatting.
---------
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>
Terminal.Gui v2 introduces a transformative redesign, simplifying the library's architecture and improving maintainability. Key changes include:
- Added TrueColor support with 24-bit RGB handling.
- Introduced `Adornment` framework for borders, padding, and margins.
- Enhanced Unicode and wide character support for internationalization.
- Added `LineCanvas` for drawing lines and shapes with box-drawing characters.
- Simplified API by consolidating redundant methods and aligning with modern .NET standards.
- Introduced `ConfigurationManager` for user-customizable themes and text styles.
- Improved scrolling with `Viewport` and integrated `ScrollBar`.
- Added new layout features like `Dim.Auto`, `Pos.AnchorEnd`, and `Pos.Align`.
- Overhauled keyboard and mouse APIs for better input handling.
- Introduced new views (e.g., `DatePicker`, `ColorPicker`, `GraphView`) and enhanced existing ones.
- Added Sixel image support for rendering graphics in compatible terminals.
- Ensured AOT compatibility for improved deployment and performance.
This update lays the foundation for building modern, user-friendly terminal applications.
Terminal.Gui v2 introduces a transformative redesign, simplifying the library's architecture and improving maintainability. Key changes include:
- Added TrueColor support with 24-bit RGB handling.
- Introduced `Adornment` framework for borders, padding, and margins.
- Enhanced Unicode and wide character support for internationalization.
- Added `LineCanvas` for drawing lines and shapes with box-drawing characters.
- Simplified API by consolidating redundant methods and aligning with modern .NET standards.
- Introduced `ConfigurationManager` for user-customizable themes and text styles.
- Improved scrolling with `Viewport` and integrated `ScrollBar`.
- Added new layout features like `Dim.Auto`, `Pos.AnchorEnd`, and `Pos.Align`.
- Overhauled keyboard and mouse APIs for better input handling.
- Introduced new views (e.g., `DatePicker`, `ColorPicker`, `GraphView`) and enhanced existing ones.
- Added Sixel image support for rendering graphics in compatible terminals.
- Ensured AOT compatibility for improved deployment and performance.
This update lays the foundation for building modern, user-friendly terminal applications.
* Initial plan
* Refactor tests to use modern ApplicationImpl.Coordinator architecture instead of legacy Application.RunIteration
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Changes before error encountered
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Replace Application.RunIteration implementation to use modern ApplicationImpl.Coordinator architecture
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Simplify Application.RunIteration to directly delegate to ApplicationImpl.Coordinator without legacy infrastructure
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update multitasking.md documentation to use Application.AddTimeout/RemoveTimeout instead of deprecated Application.MainLoop methods
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor contribution guidelines and documentation
- Consolidated all contribution-related instructions into `CONTRIBUTING.md` as the single source of truth.
- Updated `copilot-instructions.md` and `AGENTS.md` to reference `CONTRIBUTING.md`.
- Enhanced build, test, and CI/CD workflow documentation.
- Updated repository structure documentation in `README.md` and `CONTRIBUTING.md`.
- Reinforced coding conventions and streamlined testing requirements.
- Documented GitHub Actions workflows and provided local CI replication steps.
- Refined API documentation requirements and PR guidelines.
- Simplified `.sln` file and removed redundant content.
- Updated links to point to the latest documentation resources.
* Revamp bug report template for clarity and detail
Updated the bug report template to improve structure, readability, and comprehensiveness:
- Specified "Terminal.Gui" in the `about` section.
- Replaced bold headings with Markdown heading syntax.
- Enhanced "To Reproduce" with placeholders for code and behavior details.
- Added an "Environment" section to collect OS, terminal, PowerShell, .NET, and `Terminal.Gui` version details.
- Expanded "Screenshots" to include GIFs and terminal output instructions.
- Removed outdated "Desktop" and "Smartphone" sections, consolidating relevant details.
- Improved "Additional Context" with prompts for consistency, prior behavior, and error messages.
- Streamlined "For Maintainers" instructions for setting project and milestone.
These changes aim to make bug reports more actionable and easier to reproduce.
* Remove [Obsolete] attribute and pragma warnings from Application.RunIteration - method now uses modern architecture internally
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor Application.Run.cs for clarity and cleanup
Removed debug assertions and unused/commented-out code to simplify logic and improve maintainability. Renamed `forceDraw` to `forceRedraw` in `LayoutAndDraw` for better clarity. Removed the internal `OnNotifyStopRunState` method and its associated logic, indicating a refactor of the stop notification mechanism.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Initial plan
* Add missing properties to IApplication and move implementation to ApplicationImpl
- Added Force16Colors, ForceDriver, Sixel, Screen, and ClearScreenNextIteration to IApplication
- Moved implementation of these properties from Application static class to ApplicationImpl
- Updated Application.Driver.cs to delegate to ApplicationImpl.Instance
- Updated Application.Screen.cs to delegate to ApplicationImpl.Instance
- Added ResetScreen() method to ApplicationImpl for proper state cleanup
- Removed TODOs marked "Add to IApplication" in Application.Driver.cs
- All Application-related unit tests passing (180 passed)
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Rename Application.Initialization.cs to Application.Lifecycle.cs
- Changed terminology from "Initialization" to "Lifecycle" as requested
- Updated file comment to reflect lifecycle encompasses Init through Shutdown
- All tests still passing (193 Application-related tests)
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Address code review feedback in Application.Lifecycle.cs
- Fixed typo: 'cam' -> 'can' in XML documentation
- Fixed typo: 'Gets of list' -> 'Gets a list' in XML documentation
- Removed large block of commented-out legacy driver detection code
- Removed extra blank lines for cleaner code formatting
- All tests still passing (180 Application tests)
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix potential race condition in ApplicationImpl.Shutdown()
- Reset Screen before calling Application.ResetState() to avoid circular reference
- Application.ResetState() was trying to access ApplicationImpl.Instance while inside Shutdown()
- This could cause race conditions and crashes in test scenarios
- ResetScreen() is now called both in Shutdown() and ResetState() for safety
- All 3116 unit tests passing
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>
* Initial plan
* Refactor Application.Mouse - Create IMouse interface and Mouse implementation
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add enhanced documentation for Application.Mouse property
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add parallelizable unit tests for IMouse interface
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor Application.Mouse for decoupling and parallelism
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Move HandleMouseGrab method to IMouseGrabHandler interface
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add parallelizable tests for IMouse and IMouseGrabHandler interfaces
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add MouseEventRoutingTests - 27 parallelizable tests for View mouse event handling
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix terminology: Replace parent/child with superView/subView in MouseEventRoutingTests
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix coding standards: Use explicit types and target-typed new() in test files
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update coding standards documentation with explicit var and target-typed new() guidance
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor Application classes and improve maintainability
Refactored `Sixel` property to be immutable, enhancing thread safety.
Cleaned up `ApplicationImpl` by removing redundant fields, restructuring
methods (`CreateDriver`, `CreateSubcomponents`), and improving exception
handling. Updated `Run<T>` and `Shutdown` methods for consistency.
Standardized logging/debugging messages and fixed formatting issues.
Reorganized `IApplication` interface, added detailed XML documentation,
and grouped related methods logically.
Performed general code cleanup, including fixing typos, improving
readability, and removing legacy/unnecessary code to reduce technical debt.
* Code cleanup
* Remove unreferenced LayoutAndDraw method from ApplicationImpl
* Code cleanup and TODOs
- Updated namespaces to reflect the new structure.
- Added `Driver`, `Force16Colors`, and `ForceDriver` properties.
- Introduced `Sixel` collection for sixel image management.
- Added lifecycle methods: `GetDriverTypes`, `Shutdown`, and events.
- Refactored `Init` to support legacy and modern drivers.
- Improved driver event handling and screen abstraction.
- Updated `Run` method to align with the application lifecycle.
- Simplified `IConsoleDriver` documentation.
- Removed redundant methods and improved code readability.
* Refactor LayoutAndDraw logic for better encapsulation
Refactored `Application.Run` to delegate `LayoutAndDraw` to
`ApplicationImpl.Instance.LayoutAndDraw`, improving separation
of concerns. Renamed `forceDraw` to `forceRedraw` for clarity
and moved `LayoutAndDraw` implementation to `ApplicationImpl`.
Added a new `LayoutAndDraw` method in `ApplicationImpl` to
handle layout and drawing, including managing `TopLevels`,
handling active popovers, and refreshing the screen. Updated
the `IApplication` interface to reflect the new method and
improved its documentation.
Implemented `RequestStop` in `ApplicationImpl` and fixed
formatting inconsistencies in `Run<T>`. Added TODOs for future
refactoring to encapsulate `Top` and `TopLevels` into an
`IViewHierarchy` and move certain properties to `IApplication`.
* Refactor ApplicationImpl to enhance mouse and keyboard support
Added a new `Mouse` property to the `ApplicationImpl` class,
replacing its previous declaration, to improve mouse
functionality. Updated `MouseGrabHandler` to initialize with
a default instance of `MouseGrabHandler`.
Added comments to ensure the preservation of existing keyboard
settings (`QuitKey`, `ArrangeKey`, `NextTabKey`) for backward
compatibility. These changes enhance clarity, functionality,
and maintainability of the class.
* Merge IMouseGrabHandler into IMouse - consolidate mouse handling into single interface
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Rename Mouse to MouseImpl and Keyboard to KeyboardImpl for consistency
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>
* Fixes#4320 - Dialog and MessageBox rendering of Text should ignore HasFocus
Refactor and enhance text drawing logic
Refactored `DoDrawText` in `View.Drawing.cs` to improve efficiency by adding early exits for unnecessary operations and introducing extensibility points (`OnDrawingText`, `OnDrewText`, and `DrewText` event). Simplified `DrawText` by delegating logic to `DoDrawText`.
Added `OnDrewText` and `DrewText` event to allow custom post-draw handling. Updated `Dialog` class to ensure consistent text rendering using the `Normal` attribute and cleaned up event handling logic.
* Update Terminal.Gui/ViewBase/View.Drawing.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor Dialog text rendering logic
Refactored the `Dialog` class to improve text rendering behavior:
- Introduced `_drawingText` flag to track text drawing state.
- Updated `OnDrawingText` to set `_drawingText` to `true`.
- Updated `OnDrewText` to reset `_drawingText` to `false`.
- Replaced `GettingAttributeForRoleHandler` with `OnGettingAttributeForRole`.
- Ensures `VisualRole.Focus` uses the normal scheme attribute when drawing text.
- Removed unused event handler `GettingAttributeForRoleHandler`.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>