* Add comprehensive unit tests for WindowsKeyConverter
- Implement 118 parallelizable unit tests for WindowsKeyConverter
- Cover ToKey and ToKeyInfo methods with full bidirectional testing
- Test basic characters, modifiers, special keys, function keys
- Test VK_PACKET Unicode/IME input
- Test OEM keys, NumPad keys, and lock states
- Include round-trip conversion tests
- All tests passing successfully
Fixes#4389
* Rename `start` parameter to `viewportXOffset` for clarity
The `start` parameter in several methods and interfaces has been
renamed to `viewportXOffset` to better reflect its purpose as the
horizontal offset of the viewport during string rendering.
- Updated method signatures in `ListViewWithSelection` to use
`viewportXOffset` instead of `start`, including default values.
- Modified the `RenderUstr` method in `ListViewWithSelection` to
use `viewportXOffset` for calculating the starting index.
- Renamed the `start` parameter to `viewportXOffset` in the
`IListDataSource` interface and updated its documentation.
- Replaced all occurrences of `start` with `viewportXOffset` in
the `ListWrapper<T>` class, including method calls and logic.
- Updated the `RenderUstr` method in `ListWrapper<T>` to use
`viewportXOffset` for substring calculations.
- Adjusted the test method in `ListViewTests.cs` to reflect the
parameter name change.
These changes improve code readability and make the parameter's
role in rendering logic more explicit.
* Remove WindowsKeyConverterTests class that was added by mistake
* Modernized ListView and IListDataSource - Tons of new unit tests
Refactored `ListView` and `IListDataSource` to improve readability, maintainability, and functionality. Introduced `ListWrapper<T>` as a default implementation of `IListDataSource` for easier integration with standard collections.
Enhanced `ListView` with better handling of marking, selection, and scrolling. Replaced `viewportXOffset` with `viewportX` for horizontal scrolling. Added `EnsureSelectedItemVisible` to maintain visibility of the selected item.
Updated `IListDataSource` with detailed XML documentation and added `SuspendCollectionChangedEvent` for bulk updates. Improved null safety with nullable reference types.
Added comprehensive unit tests for `ListWrapper<T>` and `IListDataSource` to ensure robustness. Modernized the codebase with C# features like expression-bodied members and pattern matching. Fixed bugs related to `SelectedItem` validation and rendering artifacts.
* Improve index validation in ComboBox and ListView
Enhance robustness by adding stricter checks for valid indices
in ComboBox and ListView. Updated conditions in the
`_listview.SelectedItemChanged` event handler to ensure `e.Item`
is non-negative before accessing `_searchSet`. Modified the
`SetValue` method to use `e.Item` instead of `_listview.SelectedItem`.
In ListView, updated the `OnSelectedChanged` method to validate
that `SelectedItem` is non-negative (`>= 0`) before accessing
the `Source` list. These changes prevent potential out-of-range
errors and improve code safety.
* Refactor and enhance test coverage across modules
Refactored and added new tests to improve coverage, readability, and consistency across multiple test files. Key changes include:
- **ShortcutTests.cs**: Added tests for `BindKeyToApplication` and removed redundant tests.
- **SourcesManagerTests.cs**: Renamed `Update_*` tests to `Load_*` for clarity.
- **ArrangementTests.cs**: Reintroduced `MouseGrabHandler` tests, added `ViewArrangement` flag tests, and improved structure.
- **NeedsDrawTests.cs**: Replaced `Application.Screen.Size` with fixed dimensions for better isolation.
- **DimAutoTests.cs**: Updated layout tests to use fixed dimensions.
- **FrameTests.cs**: Standardized object initialization and validated frame behavior.
- **SubViewTests.cs**: Improved formatting and modernized event handling.
- **NumericUpDownTests.cs**: Decoupled layout tests from screen size.
General improvements:
- Enhanced formatting and removed redundant tests.
- Added comments for clarity.
- Introduced `ITestOutputHelper` for better debugging in `ArrangementTests`.
* Refactor to use nullable types for better null safety
Enabled nullable reference types across the codebase to improve null safety and prevent potential null reference issues. Refactored `SelectedItem` and related properties from `int` to `int?` to represent no selection with `null` instead of `-1`. Updated logic, event arguments, and method signatures to handle nullable values consistently.
Simplified object initialization using modern C# syntax and improved code readability with interpolated strings. Added null checks and early returns to prevent runtime errors. Enhanced error handling by throwing `ArgumentOutOfRangeException` for invalid values.
Updated tests to reflect the changes, replacing assertions for `-1` with `null` and ensuring proper handling of nullable values. Cleaned up redundant code and improved formatting for better maintainability.
* on` functionality has been deprecated, refactored, or removed from the `Shortcut` class.
* Refactor: Transition to instance-based architecture
Updated `Run-LocalCoverage.ps1` to increase `--blame-hang-timeout` from 10s to 60s. Improved null safety in `GuiTestContext` by adding null-conditional operators. Commented out problematic code in `SetupFakeApplicationAttribute.cs` to prevent test hangs.
Excluded `ViewBase` files from `UnitTests.Parallelizable.csproj` and removed redundant folder declarations. Simplified event handling in `IListDataSourceTests.cs` and updated `ListViewTests.cs` to use nullable reference types.
Enhanced documentation to emphasize the transition to an instance-based application architecture. Updated examples in `application.md`, `multitasking.md`, and `navigation.md` to reflect the use of `Application.Create()` and `View.App`. Clarified the obsolescence of the static `Application` class.
Revised table of contents in `toc.yml` to include new sections like "Application Deep Dive" and "Scheme Deep Dive." Added `dotnet-tools.json` for tool configuration.
These changes improve maintainability, testability, and alignment with modern C# practices.
* Refactor ListViewTests to use Terminal.Gui framework
The `ListViewTests` class has been refactored to replace the `AutoInitShutdown` attribute with explicit application lifecycle management using `IApplication` and `app.Init()` from the `Terminal.Gui` framework.
Key changes include:
- Rewriting tests to use `Terminal.Gui`'s application lifecycle.
- Adding a private `_output` field for logging test output via `ITestOutputHelper`.
- Updating `DriverAssert.AssertDriverContentsWithFrameAre` to include `app.Driver` for UI verification.
- Rewriting tests like `Clicking_On_Border_Is_Ignored`, `EnsureSelectedItemVisible_SelectedItem`, and others to align with the new framework.
- Adding explicit calls to `app.Shutdown()` for proper cleanup.
- Enabling nullable reference types with `#nullable enable`.
- Updating `using` directives and `namespace` to reflect the new structure.
These changes improve test maintainability, compatibility, and diagnostics.
* Update Terminal.Gui/Views/CollectionNavigation/CollectionNavigatorBase.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/CollectionNavigation/CollectionNavigatorBase.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/UICatalogTop.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/ListWrapper.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Terminal.Gui/Views/ListWrapper.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Updated the `SetMark` method to return `Source.IsMarked(SelectedItem.Value)` for consistency and removed an outdated comment questioning its correctness.
Enhanced the exception message in the `SelectedItem` property setter to provide clearer guidance when the value is out of range.
* Add comprehensive ListView behavior test coverage
Added multiple test methods to validate `ListView` behavior:
- `Vertical_ScrollBar_Hides_And_Shows_As_Needed`: Ensures the vertical scrollbar auto-hides/shows based on content height.
- `Mouse_Wheel_Scrolls`: Verifies vertical scrolling with the mouse wheel updates `TopItem`.
- `SelectedItem_With_Source_Null_Does_Nothing`: Confirms no exceptions occur when setting `SelectedItem` with a `null` source.
- `Horizontal_Scroll`: Tests horizontal scrolling, including programmatic and mouse wheel interactions, ensuring `LeftItem` updates correctly.
- `SetSourceAsync_SetsSource`: Validates the asynchronous `SetSourceAsync` method updates the source and item count.
- `AllowsMultipleSelection_Set_To_False_Unmarks_All_But_Selected`: Ensures disabling multiple selection unmarks all but the selected item.
- `Source_CollectionChanged_Remove`: Confirms `SelectedItem` and source count update correctly when items are removed from the source collection.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor Scrolling.cs for timer management and nullability
Enabled nullable reference types with `#nullable enable` for improved safety. Replaced the `pulsing` flag with a new `_progressTimer` object to better manage the progress bar's timer lifecycle. Updated `AppOnInitialized` and `AppUnloaded` methods to handle timer initialization and cleanup properly, preventing potential memory leaks.
Simplified code by removing unnecessary comments and aligning method signatures with nullable reference type annotations.
* Enable nullable types and add debugging utilities
* Runu tests 5 times
* Adjust abortTime in ScenarioTests to 1800
* Revert "Runu tests 5 times"
This reverts commit b9b5282315.
* Improve CI diagnostics and adjust scenario abort time
* Fix typos, update metadata,
Corrected typos in `ScenarioCategory` and comments in `Mazing.cs`.
Added the `System.Text` namespace to support additional functionality.
Introduced a new "Games" category in `ScenarioCategory`.
Updated `.DotSettings` to include "Mazing" in the user dictionary.
Improved overall code comments and metadata for clarity.
* Remove unnecessary null assertion for _progressTimer
* Update Examples/UICatalog/Scenarios/Scrolling.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan
* Remove legacy drivers and reorganize v2 architecture
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Extract Windows key helper utilities and fix build
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix all test references to legacy drivers
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update documentation to reflect new driver architecture
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Remove V2.cd diagram file
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix test failures: support legacy drivers and update exception handling
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* updated driver names
* Move V2 tests from ConsoleDrivers/V2 to proper locations
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Rename ApplicationV2 to ModernApplicationImpl to remove v2 terminology
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Remove V2 terminology from test drivers and FakeDriver classes
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Merge ModernApplicationImpl into ApplicationImpl and move to App folder
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Create modern FakeDriver with component factory architecture in Terminal.Gui project
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor: Move non-platform-dependent code from /Drivers to /App
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Code cleanup and org
* Unit test reorg
* Refactor MainLoop architecture: rename classes and enhance documentation for clarity
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add comprehensive FakeDriver tests (WIP - some tests need fixes)
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fixed FakeDriver build failures
* Fix all FakeDriver test failures - Application.Top creation and clipboard behaviors
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fixed FakeDriver build failures2
* Remove hanging legacy FakeDriver tests that use Console.MockKeyPresses
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fixed some tests
* Fixed more tests
* Fixed more tests
* Fix bad copilot (#4277)
* Update Terminal.Gui/Drivers/FakeDriver/FakeConsoleOutput.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor Application Init and Update Tests
Refactored `Application.Init` to improve initialization logic:
- Added fallback to `ForceDriver` when `driverName` is null.
- Changed repeated `Init` calls to throw `InvalidOperationException`.
- Updated `_driverName` assignment logic for robustness.
Enhanced `IConsoleDriver` with detailed remarks on implementations.
Revised test cases to align with updated `Application.Init` behavior:
- Replaced `FakeDriver` with `null` and `driverName: "fake"`.
- Skipped or commented out tests incompatible with new logic.
- Improved formatting and removed redundant setup code.
Improved code style and consistency across the codebase:
- Standardized parameter formatting and spacing.
- Removed outdated comments and unused code.
General cleanup to enhance readability and maintainability.
* Warp fix copilot (#4278)
* More fixes (#4279)
* Fixes/works around test failures and temporarily disable failing test
Updated `FakeDriver` to set `RunningUnitTests` to `true` and initialize dimensions using `FakeConsole`. Modified `TestRespondersDisposedAttribute` to set `ConsoleDriver.RunningUnitTests` in the `Before` method, ensuring proper behavior during unit tests.
Temporarily disabled the `Button_CanFocus_False_Raises_Accepted_Correctly` test in `ViewCommandTests` by adding a `Skip` parameter to the `[Fact]` attribute, referencing issue #4270.
* Allow all tests to run despite failures in UnitTests
Modified the `dotnet test` command in the `Run UnitTestsParallelizable` step to set `xunit.stopOnFail` to `false`. This ensures that the test runner does not stop execution on the first failure, allowing all tests to execute regardless of individual test outcomes.
* Refactor ApplicationScreenTests for cleaner setup/teardown
Refactored `ClearContents_Called_When_Top_Frame_Changes` test:
- Added `[AutoInitShutdown]` attribute for automatic lifecycle management.
- Replaced manual `Application.Init` and `Application.Top` setup with `Application.Begin` and `RunState`.
- Simplified event handling by defining `ClearedContents` handler inline.
- Removed explicit cleanup logic, relying on `Application.End` for teardown.
Updated `using` directives to include `UnitTests` namespace.
* Attempt to fix intermittent local test failures.
Update ApplicationImpl initialization parameter
Changed the second parameter of the `impl.Init` method in the
`FakeApplicationFactory` class from `"dotnet"` to `"fake"`.
* Code cleanup to cause Action to re-run.
* Stop tests on first failure in UnitTestsParallelizable
Updated the `dotnet test` command in `unit-tests.yml` to set the `xunit.stopOnFail` parameter to `true`. This change ensures that test execution halts immediately upon encountering a failure, allowing quicker identification and resolution of issues. Note that this may prevent the full test suite from running in the event of a failure.
* Allow all tests to run despite failures in CI
Updated `unit-tests.yml` to set `xunit.stopOnFail` to `false`
in both `Run UnitTests` and `Run UnitTestsParallelizable`
steps. This ensures that the test runner does not stop
execution on the first test failure, allowing all tests
to complete even if some fail.
* Enhance RuneExtensions docs and update user dictionary
Updated the `<remarks>` section in `RuneExtensions.GetColumns` to include details about the `wcwidth` implementation and improved readability with `<para>` tags. Added `wcwidth` to the user dictionary in `Terminal.sln.DotSettings` to avoid spelling errors.
* Improve XML doc formatting in RuneExtensions.cs
Updated the remarks section of the `GetColumns` method in the
`RuneExtensions` class to enhance readability by reformatting
and properly indenting `<para>` tags. The content remains
unchanged, describing the method's implementation via `wcwidth`
and its role as a Terminal.Gui extension for `System.Text.Rune`.
* Refactor drivers and improve clipboard handling
Replaced legacy drivers (`CursesDriver`, `NetDriver`) with
`UnixDriver` and `DotNetDriver` across the codebase, including
comments, method names, and test cases. Updated documentation
and remarks to reflect the new driver names and platforms.
Revamped clipboard handling with new platform-specific
implementations: `UnixClipboard` for Unix, `MacOSXClipboard`
for macOS, and `WSLClipboard` for Linux under WSL. Removed
the old `CursesClipboard` and consolidated clipboard logic.
Updated test cases to align with the new drivers and clipboard
implementations. Improved naming consistency and cleaned up
redundant code. Updated the README and documentation to
reflect these changes.
* Remove `PlatformColor` from `Attribute` struct
This commit removes the `PlatformColor` property from the `Attribute` struct, simplifying the codebase by eliminating platform-specific color handling. The following changes were made:
- Removed `PlatformColor` from the `Attribute` struct, including its initialization, usage, and related comments.
- Updated constructors to no longer initialize or use `PlatformColor`.
- Modified `Equals` and `GetHashCode` methods to exclude `PlatformColor`.
- Updated `UnixComponentFactory` documentation to remove references to "v2unix."
- Renamed `v2TestDriver` to `testDriver` in the `With` class for clarity.
- Removed `PlatformColor` references in `DriverAssert` and related error messages.
- Deleted test cases in `AttributeTests` that relied on `PlatformColor`.
- Cleaned up comments and TODOs related to `PlatformColor` and `UnixDriver`.
These changes reflect a shift away from platform-dependent color management, improving code clarity and reducing complexity.
Remove `PlatformColor` and simplify `Attribute` logic
The `PlatformColor` property has been removed from the `Attribute` struct, along with its associated logic, simplifying the codebase and eliminating platform-specific dependencies. Constructors, equality checks, and hash code generation in `Attribute` have been updated accordingly.
The `CurrentAttribute` property in `ConsoleDriver` and `OutputBuffer` has been simplified, removing dependencies on `Application.Driver`. The `MakeColor` method logic has been removed or simplified in related classes.
Tests in `AttributeTests` have been refactored to reflect these changes, focusing on `Foreground`, `Background`, and `Style`. Unix-specific logic tied to `PlatformColor` has been eliminated.
Additional updates include renaming parameters in the `With` class for clarity, simplifying `DriverAssert` output, and performing minor code cleanups to improve readability and maintainability.
* Refactor Terminal.Gui driver architecture for v2
Updated documentation to reflect the new modular driver architecture in Terminal.Gui v2.
- Revised `namespace-drivers.md` to include new components (`IConsoleInput`, `IConsoleOutput`, `IInputProcessor`, `IOutputBuffer`, `IWindowSizeMonitor`) and terminal size monitoring.
- Replaced "Key Components" with "Architecture Overview" and added details on the **Component Factory** pattern.
- Documented the four driver implementations (`DotNetDriver`, `WindowsDriver`, `UnixDriver`, `FakeDriver`) and their platform-specific optimizations.
- Added a "Threading Model" section to explain the multi-threaded design for responsive input handling.
- Updated examples to demonstrate driver capabilities and explicit driver selection.
In `drivers.md`:
- Expanded the "Overview" to emphasize the modular, component-based architecture.
- Reorganized "Drivers" into "Available Drivers" and added details on `FakeDriver` for unit testing.
- Added sections on "Initialization Flow," "Shutdown Flow," and platform-specific driver details.
- Provided examples for accessing driver components and creating custom drivers.
In `index.md`:
- Updated "Cross Platform" feature to reflect new driver names and clarified compatibility with SSH and monochrome terminals.
* Moved files around
---------
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: Thomas Nind <31306100+tznind@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* touching publish.yml
* ColorScheme->Scheme
* ColorScheme->Scheme 2
* Prototype of GetAttributeForRole
* Badly broke CM
* Further Badly broke CM
* Refactored CM big-time. View still broken
* All unit test pass again. Tons added. CM is still WIP, but Schemes is not mostly refactored and working.
* Actually:
All unit test pass again.
Tons added.
CM is still WIP, but Schemes is not mostly refactored and working.
* Bug fixes.
DeepMemberWiseClone cleanup
* Further cleanup of Scope<T>, ConfigProperty, etc.
* Made ConfigManager thread safe.
* WIP: Broken
* WIP: new deep clone impl
* WIP: new deep clone impl is done. Now fixing CM
* WIP:
- config.md
- Working on AOT clean up
- Core CM is broken; but known.
* WIP
* Merged.
Removed CM from Application.Init
* WIP
* More WIP; Less broke
* All CM unit tests pass... Not sure if it actually works though
* All unit tests pass... Themes are broken though in UI Cat
* CM Ready for review?
* Fixed failures due to TextStyles PR
* Working on Scheme/Attribute
* Working on Scheme/Attribute 2
* Working on Scheme/Attribute 3
* Working on Scheme/Attribute 4
* Working on Scheme/Attribute 5
* Working on Scheme/Attribute 6
* Added test to show how awful memory usage is
* Improved schema. Updated config.json
* Nade Scope<T> concurrentdictionary and added test to prove
* Made Themes ConcrurrentDictionary. Added bunches of tests
* Code cleanup
* Code cleanup 2
* Code cleanup 3
* Tweaking Scheme
* ClearJsonErrors
* ClearJsonErrors2
* Updated Attribute API
* It all (mostly) works!
* Skip odd unit test
* Messed with Themes
* Theme tweaks
* Code reorg. New .md stuff
* Fixed Enabled. Added mock driver
* Fixed a bunch of View.Enabled related issues
* Scheme -> Get/SetScheme()
* Cleanup
* Cleanup2
* Broke something
* Fixed everything
* Made CM.Enable better
* Text Style Scenario
* Added comments
* Fixed UI Catalog Theme Changing
* Fixed more dynamic CM update stuff
* Warning cleanup
* New Default Theme
* fixed unit test
* Refactoring Scheme and Attribute to fix inheritance
* more unit tests
* ConfigProperty is not updating schemes correctly
* All unit tests pass.
Code cleanup
* All unit tests pass.
Code cleanup2
* Fixed unit tests
* Upgraded TextField and TextView
* Fixed TextView !Enabled bug
* More updates to TextView. More unit tests for SchemeManager
* Upgraded CharMap
* API docs
* Fixe HexView API
* upgrade HexView
* Fixed shortcut KeyView
* Fixed more bugs. Added new themes
* updated themes
* upgraded Border
* Fixed themes memory usage...mostly
* Fixed themes memory usage...mostly2
* Fixed themes memory usage...2
* Fixed themes memory usage...3
* Added new colors
* Fixed GetHardCodedConfig bug
* Added Themes Scenario - WIP
* Added Themes Scenario
* Tweaked Themes Scenario
* Code cleanup
* Fixed json schmea
* updated deepdives
* updated deepdives
* Tweaked Themes Scenario
* Made Schemes a concurrent dict
* Test cleanup
* Thread safe ConfigProperty tests
* trying to make things more thread safe
* more trying to make things more thread safe
* Fixing bugs in shadowview
* Fixing bugs in shadowview 2
* Refactored GetViewsUnderMouse to GetViewsUnderLocation etc...
* Fixed dupe unit tests?
* Added better description of layout and coordiantes to deep dive
* Added better description of layout and coordiantes to deep dive
* Modified tests that call v2.AddTimeout; they were returning true which means restart the timer!
This was causing mac/linux unit test failures.
I think
* Fixed auto scheme.
Broke TextView/TextField selection
* Realized Attribute.IsExplicitlySet is stupid; just use nullable
* Fixed Attribute. Simplified. MOre theme testing
* Updated themes again
* GetViewsUnderMouse to GetViewsUnderLocation broke TransparentMouse.
* Fixing mouseunder bugs
* rewriting...
* All working again.
Shadows are now slick as snot.
GetViewsUnderLocation is rewritten to actually work and be readable.
Tons more low-level unit tests.
Margin is now actually ViewportSettings.Transparent.
* Code cleanup
* Code cleanup
* Code cleanup of color apis
* Fixed Hover/Highlight
* Update Examples/UICatalog/Scenarios/AllViewsTester.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update Examples/UICatalog/Scenarios/Clipping.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fixed race condition?
* reverted
* Simplified Attribute API by removing events from SetAttributeForRole
* Removed recursion from GetViewsAtLocation
* Removed unneeded code
* Code clean up.
Fixed Scheme bug.
* reverted temporary disable
* Adjusted scheme algo
* Upgraded TextValidateField
* Fixed TextValidate bugs
* Tweaks
* Frameview rounded border by default
* API doc cleanup
* Readme fix
* Addressed tznind feeback
* Fixed more unit test issues by protecting Application statics from being set if Application.Initialized is not true
* Fixed more unit test issues by protecting Application statics from being set if Application.Initialized is not true 2
* cleanup
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Subview clean up
* New Add/Remove event pattern
* Using Logging
* cleanup
* Subview -> SubView
* Test code cleanup. Killed many warnings.
* Fix tznind feedback
* Refactored AllViewTest helpers
* Moved keyboard tests to parallel
* Moved mouse tests to parallel
* Moved view tests to parallel
* Test code cleanup. Killed many warnings.
* dupe test
* Some mouse tests can't run in parallel because MouseGrabView
* Made SpinnerView more testable
* Moved more tests
* SubViews to IReadOnlyCollection<View>
* SubViews to IReadOnlyCollection<View> 2
* scrollbar tests
* shortcut tests
* Use InternalSubViews vs. _subviews
* Nuked View.IsAdded.
Added View.SuperViewChanged.
* API doc updats
* Unit Test tweak
* Unit Test tweak
* Tons of API doc updates
* Removed stale test
* Removed stale tests
* Fixed Skipped Shadow test 1
* Fixed Skipped Shadow test 2
* Fixed Skipped Shadow test 3
* Removed stale test
* Removed stale test2
* Explicit unregister of event handler on Application.Driver!.ClearedContents
* Added Toplevels to dict
* code cleanup
* spelling error
* Removed stale test3
* Removed stale test4
* Removed stale test5
* added script
* tweaked script
* tweaked script
* Created StressTests project; moved some tests
* Created IntegrationTests project; moved some tests
* New yml
* made old yml just unit tests
* Tweaked Button_IsDefault_Raises_Accepted_Correctly
* tweaked script
* cleaned up ymls
* tweakled up ymls
* stress tests...
* stress tests on ubuntu only
* Fixed WindowsDriver in InvokeLeakTest
* Fixed WindowsDriver in InvokeLeakTest2
* Added Directory.Packages.props.
Added Directory.Build.props
* Shortened StressTest time
* Removed dupe file.
* DemoFiles
* Moved all tests to ./Tests dir.
* Fixed release build issue
* Fixed .sln file
* Fixed .sl* files
* Fixing ymls
* Fixing interation tests
* Create link to the file TestHelpers.
* Created Tests/UnitTestsParallelizable.
Moved all obviously parallelizable tests.
Updated yml.
* fixing logs
* fixing logs2
* fixing logs3
* don't require stress to pass for PRs
* Fix a failure?
* tweaked script
* Coudl this be it?
* Moved tons of tests to parallelizable
* Fixed some stuff
* Script to find duplicate tests
* Testing workflows
* Updated to v4
* Fix RelativeBasePath issue
* Replace powershell to pwsh
* Add ignore projects.
* Removed dupe unit tests
* Code cleanup of tests
* Cleaned up test warnings
* yml tweak
* Moved setter
* tweak ymls
* just randomly throwing spaghetti at a wall
* Enable runing 5 test runners in par
* Turned off DEBUG_DISPOSABLE for par tests
* RunningUnitTests=true
* code cleanup (forcing more Action runs)
* DISABLE_DEBUG_IDISPOSABLE
* Added View.DebugIDisposable. False by default.
* Remobed bogus tareet
* Remobed bogus tareet2
* fixed warning
* added api doc
* fixed warning
* fixed warning
* fixed warning2
* fixed warning3
* fixed warning4
---------
Co-authored-by: BDisp <bd.bdisp@gmail.com>
* Tons of API doc updates
* Added logging control to UICatalog
* Added logging control to UICatalog - more
* fixed minor issues
* removed logs from .gitignore
* Fixed log file path
* Fixed app desc
* Fixes#3678. ContextMenu accesses disposed MenuBar.
* Preserve always the last menu opened.
* Re-added MenuAllClosed event.
* Ensures call CleanUp if Application.MouseGrabView hold another MenuBar than the calling one.
* Fix unit tests.
* Passing the offending object instead of the View type.
* Add that to the dictionary to shut respeller up.
* Address a few warnings
* A question
* Just a little more cleanup
* Combine these and comment
* Slight additional cleanup
* More minor cleanup
We already know it is null. just make it the else instead of a new condition
* Nullable != true ===> is not true
* Unconditional break at the top is just a part of the while statement (inverted)
* Fixes#3687. ColorPicker isn't respecting the current UI culture.
* Fix @dodexahedron erroneous code.
* Cleanup comments.
---------
Co-authored-by: Brandon Thetford <github@snapsinazfs.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
* Removed resharper settings from editorconfig
* Remove constructors with frame parameters from Button class.
* Remove constructors with frame parameters from CheckBox class.
* Cleanup code.
* Remove constructors with frame parameters from ComboBox class.
* @BDisp
Remove constructors with frame parameters from FrameView class.
* Remove constructors with frame parameters from Label class.
* Remove constructors with frame parameters from ListView class.
* Remove constructors with frame parameters from ScrollBarView class.
* Remove constructors with frame parameters from ScrollView class.
* Remove namespace braces.
* Cleanup code.
* Cleanup code.
* Cleanup code.
* Remove constructors with frame parameters from TextField class.
* Remove constructors with frame parameters from TimeField class.
* Fixes#3182. OnResizeNeeded returns int.MaxValue and int.MaxValue when Application.Top is null, should return Size.Empty.
* Remove constructors with frame parameters from Toplevel class.
* Remove constructors with frame parameters from Window class.
* Fix merge errors.
* Revert "Fixes #3182. OnResizeNeeded returns int.MaxValue and int.MaxValue when Application.Top is null, should return Size.Empty."
This reverts commit cf9c24b846.
* Revert unit test.
* Fixes#2882. TabView: 'Frame.DrawFrame(Rect, bool)' is obsolete: 'This method is obsolete in v2. Use use LineCanvas or Frame (#2980)
* Fixes#2882. TabView: 'Frame.DrawFrame(Rect, bool)' is obsolete: 'This method is obsolete in v2. Use use LineCanvas or Frame
* Trying fix this unit test that sometimes fail.
* Fixes#2983. View need a alternative DrawFrame for the v2.
* Use new DrawFrame method.
* Change _lines field to Lines property.
* Add TabWindow unit test.
* Add DrawIncompleteFrame method and unit tests.
* Add more unit tests to LineCanvas.
* Fix newline conflict errors.
* Revert "Change _lines field to Lines property."
This reverts commit ab6c5f3094.
* Add DrawIncompleteFrame method and unit tests.
* Add more unit tests to LineCanvas.
* Fix newline conflict errors.
* Force render immediately instead of join.
* I will never rely on zero-location-based unit test again.
* Fix TestTreeViewColor unit test fail.
* Using location of 3 to avoid be divisible by 2 and so avoiding bugs.
* Revert "Using location of 3 to avoid be divisible by 2 and so avoiding bugs."
This reverts commit dd3df135d8.
* Revert "I will never rely on zero-location-based unit test again."
This reverts commit 62adf6f285.
* Revert "Fix newline conflict errors."
This reverts commit 4acf72612d.
* Revert "Add more unit tests to LineCanvas."
This reverts commit 66bc6f514e.
* Revert "Add DrawIncompleteFrame method and unit tests."
This reverts commit 680ba264e1.
* Resolving merge conflicts.
* Revert "Use new DrawFrame method."
This reverts commit 69a7f17f19.
* Revert "Fixes #2983. View need a alternative DrawFrame for the v2."
This reverts commit dade9fd767.
* Reverting this changes to start a new one.
* Add horizontal and vertical support for combining glyphs.
* Fix text and auto size behavior.
* Add TabWidth property.
* Add unit test for WordWrap.
* Fixes#3017. View TextDirection returns incorrect size on a vertical direction instance with AutoSize as false.
* Using Frame to force read from the get method.
* Fix some issues with AutoSize and ForceValidatePosDim.
* Fixing broken unit tests.
* Restoring code I've broken.
* Removing forgotten code.
* Only LayoutStyle.Computed can change the Frame.
* DateField and TimeField depends on LayoutStyle.Computed.
* Fix unit tests related with LayoutStyle.
* Implements tabs, left and right arrows as View.
* Draws a minimum full border.
* Adds missing XML parameter.
* Adds assert tests for Frame.
* Removes duplicates InlineData.
* Adds more unit tests for minimum full border without Left and Right thickness.
* Trying to fix the TestTreeViewColor unit test fail.
* Prevents a user to set TextDirection to -1.
* Prevents any invalid TextDirection value.
* Removes (TextDirection)(-1).
* Removes unnecessary TextDirection initialization.
* Removes LayoutStyle.
* Fixing unit tests with border.
* Trying to fix TestTreeViewColor again.
* Revert "Trying to fix TestTreeViewColor again."
This reverts commit c2efa8e42e.
* Trying to fix TestTreeViewColor again.
* Fix merge errors.
* Fix merge errors.
* Restoring unit test.
* Restores the right XML comment.
* Fix Disposing unit tests that sometimes throws because some instances aren't cleared on others unit tests classes.
* Fix Disposing unit tests that sometimes throws because some instances aren't cleared on others unit tests classes.
* Only call OnResizeNeeded if it's LayoutStyle.Computed.
* Fix merge errors.
* Fix merge errors.
* Fix unit tests fail.
* Reformat.
* Again.
* Rename to OnDrawAdornments.
* Fix failing unit tests.
* Reduces indentation and cleanup code.
* Cleanup code.
* Fix bug done when cleanup.
* Replace FrameHandledMouseEvent to AdornmentHandledMouseEvent.
* Removes Tab constructor parameters.
---------
Co-authored-by: Tig <tig@users.noreply.github.com>
* Fix merge errors.
* Remove constructors with parameters from Button.
* Remove parenthesis on objects initializers from Button.
* Remove constructors with parameters from CheckBox.
* Remove parenthesis on objects initializers from CheckBox.
* Remove constructors with parameters from ComboBox.
* Remove constructors with parameters from FrameView.
* Remove parenthesis on objects initializers from FrameView.
* Initial commit
* Renamed Direction enum for clarity in refactoring unit tests
* Moved nav tests to NavigationTests
* Moved view tests around
* Cleaning up TextFormatter and View.AutoSize code
* Fixed latent TextFormatter bug with \n
* removed Application dependency on some autosize unit tests
* Fixed Label tests to deal with auotsize overriding height/width
* Fixed more label tests. WIP
* Fixed all places where AutoSize = happend after setting Dims
* Started adding new primitive View.Text tests
* Code comments
* WIP: Enforce that it makes no sense to set Width/Height if AutoSize = true. Update Unit tests to match.
* WIP: Enforce that it makes no sense to set Width/Height if AutoSize = true. Update Unit tests to match.
* Remove frame set from the View constructor and prevent SetRelativeLayout running if not yet initialized.
* Changes needed for unit tests pass on remove parameters constructors from the Label class.
* Remove constructors with parameters from Label.
* Remove parenthesis on objects initializers from Label.
* Prefix private fields with underscore.
* Renamed to MaxLength.
* Remove constructors with parameters from ListView.
* MakeWrapper not needed anymore.
* Remove parenthesis on objects initializers from ListView.
* WIP: Enforce that it makes no sense to set Width/Height if AutoSize = true. Update Unit tests to match.
* Massive code cleanup - use parameterless constructors and ensure AutoSize is set properly. Code reformat.
* Massive code cleanup - use parameterless constructors and ensure AutoSize is set properly. Code reformat.
* Fixed messagebox
* Remove constructors with parameters from ScrollBarView and ScrollView.
* Remove parenthesis on objects initializers from ScrollBarView and ScrollView.
* Cleanup code.
* Fix merge errors.
* Add empty dotsettings for solution and projects.
* Set ReSharper language analysis level for projects to C#12
* Make ReSharper consider itself the boss for style
* Add rule to enforce property backing fields above the property
* Disable auto-detection of naming rules so ReSharper doesn't change them by itself
* Don't let someone's VS settings override the indent settings
* Explicitly set tab width to 4 spaces and force spaces.
* Rules to keep various multi-line constructs aligned within themselves
* Curly brace rules (Using K&R style, per current project spec)
* Blank line rules
Mostly to add breaks in various situations, and also to enforce max of 1 blank line.
* Increase auto-wrap to 160 from default of 120
* Line break at end of all files, to make Unixy systems happy
* Keep attributes on their own lines except for methods and records that are themselves single-line
* Increase attribute auto-wrap to 60 from default of 38
* Wrap/chop rules for long method signatures and record declarations
Chop if either already multi-line or if over 8 parameters.
Chop AFTER the left paren and BEFORE the first parameter.
* Chop rules for generics
For generics with multi-line type parameters or multiple type parameter constraints, chop in a way that has consistent alignment.
* Always enforce enum members on their own lines
* One-line functions completely on one line
They're usually expression-bodied anyway, here, so this is almost irrelevant
* Keep control flow statements on their own lines
* Follow same chop rules for method invocation as method declaration
* Chop long or multi-line method chains or patterns
* Wrap rules for binary operators
Operator at beginning of new lines
Auto-chop if long or already multi-line
* Spaces between keywords and their opening parentheses
* Add file layout rules for organization of reorderable items like fields, properties, etc.
Ugly XML, so load it up in the UI to look at it
It's MOSTLY the ReSharper defaults, but with more aggressive sorting, generally by access modifier and name, within each grouping.
* Deconstructors use per-member types
* Use keywords for built-in types and increase severity of inspection for violations
Also apply to IntPtr and similar, which should now be nint and similar
* Apply syntax style on completion.
* Use var when evident for built-in and simple types, but not elsewhere
* Increase severity for some minor redundancy and clarity inspections
* Enforce braces always required for blocks, and treat as error
* Warn if a local function is not statement-bodied
* Increase various inspection severities
IF Condition => Severity:
Attributes not wrapped property => Suggestion
Constructors expression-bodied => Error
default doesn't have type when it isn't clear => suggestion
Namespaces not file-scoped => error
Methods not statement-bodied => hint
Null check pattern not the object property pattern => Error
* Adjust preference order of null check patterns to make object pattern highest
* XmlDoc rules to keep tags and contents aligned and wrapped
* Add a few custom profiles for code cleanup and make the full profile default
* Remove parts for languages not used in this solution
* copied in v2_develop changes
* Merged v2_develop
* Added Begin/Init unit tests. Removed Application dependencey from AutoSizeFalse tests
* TextFormatter.Lines -> GetLines ()
* Let ReSharper know we intend to localize things
* TextFormatter code cleanup
* copied in v2_develop changes
* Merged v2_develop
* Spaces aren't wanted here either.
* Fix merge errors.
* Fixes ContentBottomRightCorner related with https://github.com/gui-cs/Terminal.Gui/issues/3211#issue-2098878820
* Remove constructors with parameters from ContextMenu.
* Remove commented code.
* Remove constructors with parameters from OpenDialog.
* Remove constructors with parameters from SaveDialog.
* Remove constructors with parameters from TextField.
* Remove constructors with parameters from TimeField.
* Fix unit test.
* Remove unnecessary SetInitialProperties method.
* Remove unnecessary SetInitialProperties method.
* Remove parenthesis on objects initializers from Toplevel and Window.
* Remove constructors with parameters from RadioGroup.
* Remove constructors with parameters from TextView.
* Remove constructors with parameters from MenuBar.
* TEMPORARY: Turn everything that was set to error down to warning or lower
* Fixes#3219. MenuBar is opened by call OpenMenu even it's disabled.
* Remove constructors with parameters from Menu.
* Remove constructors with parameters from View.
* Change constructor to internal because is mainly useful for testing.
* ReSharper Cleanup Code.
* Added format only r# config
* Fixes#3224. TextFormatter.Lines should return a single string.Empty list even with Width or Height equal to zero.
* Remove constructors with parameters from Dialog.
* Remove constructors with parameters from TextValidateField.
* Fixes https://github.com/gui-cs/Terminal.Gui/issues/3224#issuecomment-1924096038
* Fixes#3225. Press CursorDown on TabView doesn't move to the next view.
* Fixes#3229. TextFormatter should have a FillRemaining property.
* Testing formatting merge in bdisp
* Testing formatting merge
* Testing formatting merge bdisp
* Testing formatting merge 2
* xmldoc format
* R# Full Code Cleanup
* R# Full Code Cleanup2
* R# Full Code Cleanup2
* Merged! But broke tests
* Refixing...
* Refixed DrawTests
* Refixed ViewTests
* Refixed Text Tests
* Refixed more unit tests
* Refixed scenarios
* Refixed rest of scenarios
* Refixed ViewsTests
* Refixed rest of tests. All unit tests pass again!
* Fixed warnings
* Updated R# version. Added new code cleanup settings
* Applied latest code cleanup to solution
* Another code cleanup pass
* Tweaked r# settings. .editorconfig now matches.
* r# else on separate line
* r# - update
* r# - full solution
* test commit
* test commit
* test commit
* Removed extra profiles
* Full cleanup following cleaning up profiles
* Null checking pattern rules/inspections
* Tabs and extra whitespace are evil
* Attributes on their own lines
* Code layout rules to put fields first and to put backing fields with their properties
* Merged v2_develop
* Full cleanup following dodexahedron's PR
---------
Co-authored-by: BDisp <bd.bdisp@gmail.com>
Co-authored-by: Brandon Thetford <github@snapsinazfs.com>
* Reduces indentation by remove the namespace braces.
* Reduces indentation and removes unused using.
* Ensures clear selection if it isn't selecting.
* Turn on nullability context for TryParse and update usages as needed.
* Use IsNullOrWhiteSpace, which includes IsNullOrEmpty
All-whitespace values are also illegal, so may as well handle that here too
* Respect the nullable here
* It's a struct
* Use byte.MaxValue and add remark
* Just use the bytes directly
* Must respect endianness
* Add uint constructor so consumers don't have to do unchecked math
* Completely re-work parsing and implement ISpanParsable<Color>
All parsing is now almost-0 allocation, and is significantly faster than before
* Extension methods required by new code
* Use standard Math.Clamp method here
* Add some new unit tests for TryParse
* De-duplicate code and handle more cases
* Enable nullability context for the file
* Go ahead and enable the language features and analysis
* Implicit usings remove a lot of boilerplate usings.
* Add these to the dictionary to shut spell check up
* Make this thing a record struct and a union, and update constructors
This commit won't build. I'm just breaking out changes a little bit.
* Some additional XmlDoc standardizing
* Make FindClosestColor and CalculateColorDistance use the vector for SIMD
* Add a TryFormat method for support of I*Formattable
* Add an interface for support of custom formatting of Colors
* Pass by in reference
* Parse string delegates to Parse span
* Parse now does all the work
* Remove the old new code from TryParse
* Some new cast operators
* Add IFormattable.ToString implementation
* Add the rest of the code for Color in its current (unfinished) state
* Move that interface to its own file
* Add ColorParseException class
* Move Attribute to its own file, too.
* Re-implement these operators as explicit methods
* Get rid of fuzzy equality operators and update tests to use the named methods that replace them
* Add an explicit test case for ToString with null format string and explicitly specified Invariant culture
* Fix byte orders for hex format to be standard ARGB
* Prove that ToString and Parse can round-trip values
* Unroll this test into parameterized cases
* Fix a couple of comments to match byte order
* Update R# dictionary to match correct byte orders
* Remove stray comment
* Separate all types in this to their own files
* Convert this one to use the handy extension
* Add test for Argb property
* Add a file nesting rule to make some incoming file changes display nicely
* Move constructor tests to their own file and add some new tests
* Add implicit cast from uint
* More constructor tests
* Since this is now a record, the equality operators are compiler generated
Still spot-checking a few arbitrary values for completeness
* Override ToString to delegate to Attribute
* Simplify and clean up ToString. Delegate to ColorScheme
* Update the test to match new output
* These should be fields, really. It's a value type.
* Add some type checks for change control
* Allow unsafe and turn on implicit usings
* Make this one better
* Rename tests and remove redundant checks (the type checks already guarantee field consistency)
* Reorganize a bit
* Make these test 16 random values
* Existing operator tests converted
* That one is now redundant with both of the other tests that check all the named colors
* Move this to type checks and simplify a little bit
* These lambdas can be static
* Move operators to another file.
* Add global using for System.Text because it's EVERYWHERE
* Reorganization of Color and some related types.
Updated usages to reflect changes
* Update tests to reflect changes in Terminal.Gui
* Add missing keyword
* Add entry to dictionary
* Add dotsettings for Terminal.Gui
Only specifies language level
* Commit unsaved changes for usings here
* Implement last remaining TryFormat method
* A little cleanup/formality
* Sorting rules
Sort methods by name and interface they implement
* Sort code
* Match namespace for tests
None!
* Unroll ordinal check and reorganize.
* Sort before writing new tests
* These got reversed...
* Add test to prove explicit cast to Vector3 works properly
* Sort these too
* Add test for uint->Color implicit operator
* Add test for Color->uint implicit operator
* Correct this test name and re-order
* Add test for implicit conversion from Vector3 to Color
* Add test for implicit conversion from Vector4 to Color
* These also got reversed, like with Vector3
* Add test for implicit conversion from Color to Vector4
* Add test for GetHashCode
* Make sure these are all under the same namespace
* Remove a now-redundant test
* Reorganize formatting and parsing tests to another type part
* Tests moved back to Terminal.Gui.DrawingTests namespace as before.
* Add tests for the constructor taking 3 or 4 integers and sort
* Cleanup
- Renamed some tests
- Make a test even clearer
- Removed redundant code
- Got rid of unused parameter in Constructor_WithColorName_AllChannelsCorrect
* That needs to be from the reverse map
Not broken - just was sub-optimal due to my error.
* Enable nullability context in this file
Not sure how it got removed but whatev
* Respect nullability context in this file now that it's on 🤦♂️
* Add tests for expected exceptions with whitespace or null values
* Add test for parameterless constructor
* A couple more places for reference passing and some SkipLocalsInit attributes.
* Some XmlDoc corrections to reflect the final implementation
* Remove namespace qualifier
* Can't use these because of lambdas :(
* Removed a collection that never ended up being needed.
* Add bracing, newline, and modifier style rules
* Add spacing rules inside parens/brackets
* This was still under the Terminal.Gui.Drawing namespace. Revert that.
* Applied updated formatting settings and addressed XmlDoc reviews in #3204
* More places where spaces got added in dependent code.
Also a couple of null checks fixed to not use the equality operator
* More dependent code format fixes
* Finished re-formatting modified code that got spaces added everywhere
* Visual studio didn't actually write this file to disk til I closed out of VS...
Grr
* Delete the ReSharper settings files from this branch.
---------
Co-authored-by: BDisp <bd.bdisp@gmail.com>