mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-02-10 04:03:41 +01:00
v2_develop
75 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f2d260a853 |
Add TryGetSource extension methods for WeakReference<View> access (#4694)
* Initial plan * CommandContext infrastructure: WeakReference and extension methods Co-authored-by: tig <585482+tig@users.noreply.github.com> * Align CommandContext infrastructure with PR #4620 - Update ViewExtensions.cs to use Terminal.Gui.ViewBase namespace - Update WeakReferenceExtensions.cs to match PR #4620 format - Change CommandContext constructor to take WeakReference<View>? directly - Add CommandContext.ToString() implementation - Update ICommandContext.Source documentation - Update View.Command.cs to explicitly create WeakReference - Update Shortcut.cs to handle WeakReference Source - Update ComboBox.cs Source comparison - Update Dialog.cs and DialogTResult.cs pattern matching - Update MenuBar.cs and PopoverMenu.cs to work with WeakReference - Update ScrollSlider.cs and OptionSelector.cs Remaining: Fix Examples code and tests Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix Examples code for WeakReference Source - Update UICatalogRunnable.cs to use TryGetTarget for Data access - Update Menus.cs to use ToIdentifyingString() and TryGetTarget - Update MouseTester.cs to use ToIdentifyingString() for all Source.Id access All Examples now build successfully Co-authored-by: tig <585482+tig@users.noreply.github.com> * Update tests for WeakReference Source - Fix CommandContextTests.cs to wrap Source in WeakReference - Fix InputBindingTests.cs to wrap Source in WeakReference - Update assertions to use TryGetTarget for safe access - All CommandContext and InputBinding tests pass Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add TryGetSource extension methods and replace usage - Add TryGetSource extension to WeakReferenceExtensions.cs - Add CommandContextExtensions.cs with TryGetSource for ICommandContext - Replace 14 instances of Source?.TryGetTarget pattern across codebase - Updated Terminal.Gui files: ComboBox, Dialog, DialogTResult, MenuBar, PopoverMenu, OptionSelector, Shortcut - Updated Examples files: UICatalogRunnable, Menus - All files build successfully Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add tests for TryGetSource extension methods - Add 6 tests for TryGetSource extension methods - Test WeakReference<View>.TryGetSource with valid/null references - Test ICommandContext.TryGetSource with valid/null contexts - Test pattern matching usage with TryGetSource - All 23 CommandContext tests pass - Full test suite: 15,094 passed Co-authored-by: tig <585482+tig@users.noreply.github.com> * code cleanup --------- 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> |
||
|
|
e9976da95e |
Reapply "Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop"
This reverts commit
|
||
|
|
845c05ff47 |
Revert "Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop"
This reverts commit |
||
|
|
a4ce6fb4d3 |
Refactor MouseGrabView to WeakReference-based IsGrabbed() method (#4613)
* Initial plan * Refactor MouseGrabView to WeakReference - Core implementation complete Co-authored-by: tig <585482+tig@users.noreply.github.com> * Replace MouseGrabView with IsGrabbed(view) in test files Updated test files to use the new IsGrabbed(view) method instead of the deprecated MouseGrabView property: - Assert.Equal(view, mouse.MouseGrabView) → Assert.True(mouse.IsGrabbed(view)) - Assert.Null(mouse.MouseGrabView) → Assert.False(mouse.IsGrabbed(anyView)) - mouse.MouseGrabView == view → mouse.IsGrabbed(view) - mouse.MouseGrabView != view → !mouse.IsGrabbed(view) - Updated method names and comments referencing MouseGrabView Files updated: - Tests/UnitTests/Application/Mouse/ApplicationMouseTests.cs - Tests/UnitTestsParallelizable/ViewBase/Mouse/HighlightStatesTests.cs - Tests/UnitTestsParallelizable/Application/RunTests.cs - Tests/UnitTestsParallelizable/Application/Runnable/RunnableIntegrationTests.cs - Tests/UnitTestsParallelizable/Application/ApplicationImplTests.cs - Tests/UnitTestsParallelizable/Application/InitTests.cs - Tests/UnitTests/View/Adornment/ShadowStyleTests.cs - Tests/UnitTests/View/ArrangementTests.cs - Tests/UnitTests/View/Mouse/MouseTests.cs All tests pass successfully. Co-authored-by: tig <585482+tig@users.noreply.github.com> * Complete MouseGrabView refactoring - tests and documentation updated Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix mouse grab enter/leave logic - check grab state first Co-authored-by: tig <585482+tig@users.noreply.github.com> * Improve null-conditional pattern consistency for IsGrabbed calls Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix code style - use target-typed new() for WeakReference Co-authored-by: tig <585482+tig@users.noreply.github.com> * Code clean up and org. * Code cleanup and better docs. * Add IMouseGrabHandler.IsGrabbed() and related tests Introduce a new parameterless IsGrabbed() method to IMouseGrabHandler, allowing checks for any active mouse grab regardless of view. Implement this method in MouseImpl, using WeakReference to determine grab state. Add comprehensive unit tests in ApplicationMouseTests and MouseInterfaceTests to verify correct behavior across grab, ungrab, disposal, and state reset scenarios. Also, perform minor code cleanups in MouseInterfaceTests.cs for clarity and consistency. * code cleanup --------- 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> |
||
|
|
004bfd200b | Fixed shft selection bug. | ||
|
|
93dbb55b28 |
Fixes multiple ANSI driver issues (#4586)
* New workflow that will analyze the dmp file on the macos runner. * Refactored Ansi driver for clarity and easier debugging. * Fixes cmd.exe stuff. * Code cleanup * Rolled back dotnet version to work on linux. * Added (semi-bogus) input injector tests. * Tweaks * skipped bogus test * Code cleanup * Fixed #4587 * Ported @bdisp test updates * Diusabled more logging. |
||
|
|
5cfe526240 | fixed dot settings | ||
|
|
d4ed07dcde | Merge branch 'v2_develop' into cleanup-agent-docs-update | ||
|
|
d4616eb582 | Progress. | ||
|
|
ad6a20d79b |
Fixes #3735. Rename GraphView coordinate methods and variables to use viewport terminology (#4557)
* Initial plan * Add tests for GraphView border rendering Co-authored-by: tig <585482+tig@users.noreply.github.com> * Rename GraphSpaceToScreen/ScreenToGraphSpace to clarify they use viewport coordinates Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix spelling: CoPilot -> Copilot Co-authored-by: tig <585482+tig@users.noreply.github.com> * Address review feedback: rename variables, remove obsolete methods, fix comments Co-authored-by: tig <585482+tig@users.noreply.github.com> * Refactor graphing axes and series into separate files Split Axis, ISeries, and related classes into dedicated files for improved modularity and maintainability. Updated property initializers, documentation, and code style throughout. Adjusted GraphViewExample and fixed minor typos. Updated .DotSettings and package files. * Remove local_packages directory (build artifacts) Co-authored-by: tig <585482+tig@users.noreply.github.com> * Update .gitignore * added release packages --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tig <585482+tig@users.noreply.github.com> Co-authored-by: Tig <tig@users.noreply.github.com> |
||
|
|
cc8ff633fa |
Fixes #4417 - Updates UI Catalog & Scenarios to instance-based app model (#4547)
* Add ScenarioRunner project and extract Runner class (#4417) - Create Examples/ScenarioRunner project with CLI for running scenarios - Extract Runner class to UICatalog with RunScenario and benchmark methods - Refactor UICatalog.cs to use the shared Runner class - CLI supports: list, run <scenario>, benchmark [scenario] Part of issue #4417 - Phase 4 implementation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * tweaks * Extract interactive mode loop and config watcher to Runner class - Move RunInteractive<T>() method to Runner class for reusable scenario browser loop with config file watching - Add Force16Colors option to ScenarioRunner and UICatalog CLI - Add ApplyRuntimeConfig() to Runner for consistent driver/color settings - Refactor UICatalog to delegate to Runner.RunInteractive<UICatalogRunnable>() - Remove duplicated config watcher and verification code from UICatalog Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Refactor to use IApplication; remove static Application usage Refactored the codebase to adopt the new IApplication interface and instance-based application lifecycle management. Replaced static Application.Init/Shutdown/Run calls with Application.Create()/app.Init()/app.Run() patterns for proper disposal and flexibility. Updated usages of Application.Driver and Application.IsMouseDisabled to use instance-based access via App or Driver. Modernized event handler patterns, made UI fields nullable and non-readonly, and improved scenario launching logic. Switched driver name retrieval to DriverRegistry.GetDriverNames(). Cleaned up command-line parsing and removed obsolete suppressions. Added "Dont" to the user dictionary. These changes reduce reliance on static state, improve maintainability, and align the codebase with current Terminal.Gui best practices. * Modernize scenarios to use instance-based Application model and add lifecycle events Update all UICatalog scenarios to use the modern instance-based Application pattern (Application.Create() / app.Init()) instead of the legacy static pattern. Add thread-local static events (InstanceCreated, InstanceInitialized, InstanceDisposed) to Application for monitoring application lifecycle in tests. Update ScenarioTests to use new events and fix documentation examples in arrangement.md and config.md. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add FSharpExample project to solution Added a new F# example project (FSharpExample) to the solution under the Examples folder. Updated the solution file to include the project, its GUID, and configuration mappings for Debug and Release builds. This improves language coverage in the example set. * Remove FSharpExample project from solution * Remove custom handling of Application.QuitKey Eliminated code that saved, restored, and modified Application.QuitKey. The application no longer changes the QuitKey to Ctrl+F4 on load, and no longer restores the original QuitKey after execution. * Fix LineDrawing.PromptForColor to use IApplication and add try/catch to scenario tests - Add IApplication parameter to PromptForColor method so dialogs can run properly with the modern instance-based Application model - Update all callers in LineDrawing.cs, RegionScenario.cs, and ProgressBarStyles.cs - Add try/catch around scenario execution in ScenarioTests to prevent test host crashes when scenarios throw exceptions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add in-memory log capture for scenario debugging with error dialog - Add ScenarioLogCapture class (ILoggerProvider) for capturing logs in-memory - Integrate LogCapture into UICatalog logger factory - Add MarkScenarioStart/GetScenarioLogs for scenario-scoped log capture - Track HasErrors flag for Error-level and above logs - Add unit tests for ScenarioLogCapture (17 tests) - Add unit tests for Runner class (8 tests) - Various refactoring and cleanup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix benchmark mode to use instance-based Application model - Update Scenario.StartBenchmark to use Application.InstanceInitialized and Application.InstanceDisposed instead of legacy InitializedChanged - Store app instance and use it for timeouts, events, and InjectKey - Fix UICatalog.cs to pass options.Benchmark instead of hardcoded false - Add XML documentation to BenchmarkResults and Scenario benchmark APIs - Use expression-bodied members for simple Scenario methods Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fixed bug. * fixed bug * Fix Release build failures - Wrap View.VerifyViewsWereDisposed() calls in #if DEBUG_IDISPOSABLE (method only exists in Debug builds) - Change SelfContained and NativeAot to always use ProjectReference (fixes build order issues in Release configuration) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * tweaked gitignore --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
c4a2a05e11 |
Fixes #3444 - Modern Cursor design + fix View.MostFocused (#4529)
* Initial plan
* Updated cursor.md with current implementation analysis and improvement proposals
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix View.MostFocused to return this when HasFocus && Focused == null
- Changed MostFocused to check HasFocus first and return null if view doesn't have focus
- When view has focus but no focused subview, returns this instead of null
- Updated test GetMostFocused_NoSubViews_Returns_Null to GetMostFocused_NoSubViews_Returns_This
- All 299 navigation tests pass
- All existing tests that check MostFocused == null still pass (they test views without focus)
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Improve PositionCursor documentation, add SetCursorNeedsUpdate, and cache cursor position
- Enhanced PositionCursor() XML documentation with:
- Clear statement that method is only called on most focused view
- Warning not to call drawing methods (Move, AddRune) in PositionCursor
- Code example showing proper implementation
- Removed problematic default implementation that called Move()
- Added SetCursorNeedsUpdate() API:
- New method in View.Cursor.cs for signaling cursor moved without redraw
- Added SetCursorNeedsUpdate() to IApplicationMainLoop interface
- Implemented in ApplicationMainLoop with driver-specific casting
- Added MainLoop property to IApplication (internal, object type)
- Documented with XML comments and code examples
- Implemented cursor position caching in ApplicationMainLoop.SetCursor():
- Added _cursorNeedsUpdate flag to force update on demand
- Added _lastCursorView, _lastCursorPosition, _lastCursorVisibility for caching
- SetCursor() now only calls PositionCursor() when needed:
- Focus changed to different view
- Cursor position changed
- Cursor visibility changed
- SetCursorNeedsUpdate() was called
- Reduces redundant PositionCursor() calls by ~99% in steady state
All tests pass:
- 299 Navigation tests pass
- 181 AllViewsNavigationTests pass
- Reduced warnings from 7 to 3
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Refactor cursor management to ApplicationNavigation to remove coupling
- Moved cursor caching and UpdateCursor() from ApplicationMainLoop to ApplicationNavigation
- ApplicationNavigation now manages cursor state and position caching
- ApplicationNavigation subscribes to its own FocusedChanged event to trigger cursor updates
- ApplicationMainLoop.SetCursor() now simply delegates to ApplicationNavigation.UpdateCursor()
- View.SetCursorNeedsUpdate() now calls App.Navigation instead of App.MainLoop
- Removed MainLoop property from IApplication (no longer needed)
- Removed SetCursorNeedsUpdate() from IApplicationMainLoop interface
Benefits:
- Eliminates coupling between ApplicationMainLoop and View hierarchy
- ApplicationMainLoop no longer accesses App.TopRunnableView.MostFocused
- Cursor management is now properly co-located with focus management in ApplicationNavigation
- Cleaner separation of concerns
All tests pass:
- 299 Navigation tests pass
- No new warnings introduced
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix cursor positioning by removing broken caching logic
The cursor position caching introduced in commit
|
||
|
|
a43d50e2e9 |
Code cleanup of TextField and TextView (#4533)
* Add comprehensive XML documentation for cursor positioning in TextField, DateField, and TimeField Documents how _cursorPosition, CursorPosition, and PositionCursor() work together: - _cursorPosition: Internal 0-based index into text elements - CursorPosition: Public property with clamping and selection updates - PositionCursor(): Converts logical position to screen coordinates Documents TextField selection model: - _selectedStart: Anchor point for selections - _start: Normalized start for drawing - PrepareSelection: Selection state management Documents DateField/TimeField cursor behavior: - Position constraints (1 to FormatLength, skipping position 0) - AdjCursorPosition: Skip over separator characters - IncCursorPosition/DecCursorPosition: Navigation with separator awareness * TextView code cleanup * Code cleanup * Refactor TextField and TextView into partials; add TextModel tests - Split TextField into partial classes for commands, drawing, keyboard, mouse, selection, text, and history logic - Move TextFieldAutocomplete to its own file with namespace - Change DeleteCharLeft/Right to return bool in TextField, DateField, and TimeField - Modernize C# style and improve XML docs throughout - Make key TextModel methods/enums internal for testing - Add comprehensive TextModel unit tests (TextModelTests.cs) - Minor bug fixes and code cleanups; no public API breaks * Refactor TextView command and movement handling - Simplified command registration to use concise lambdas returning bool for success/failure. - Split movement and find logic into separate partial class files for modularity. - Standardized return values for editing and movement methods. - Added backing fields for CurrentColumn/CurrentRow to keep cursor position in sync. - Updated undo/redo and context menu logic to return bool and check read-only state. - Moved drawing event declarations for clarity. - Cleaned up list construction, removed redundant code, and improved documentation. - Improved keyboard and mouse event handling, including double-click selection. - Overall, enhances maintainability, testability, and extensibility. * Add refactor plan for TextField InsertionPoint terminology Documents the planned renaming of cursor-related fields and methods to use InsertionPoint terminology, which better reflects that these are logical text indices rather than screen cursor positions. * Refactor: Rename CursorPosition to InsertionPoint Update TextField, DateField, and TimeField to use "InsertionPoint" terminology for all fields, properties, and methods previously named "CursorPosition". This clarifies that these members represent a logical text index, not a screen position. Includes updates to related selection fields, internal helpers, and documentation. No backward compatibility shims required. * Refactor: Rename cursor fields to InsertionPoint Renamed all cursor-related fields, properties, and methods in TextField, DateField, and TimeField to use "InsertionPoint" terminology for clarity. Updated XML documentation and tests to match. No compatibility shims added; PositionCursor() name retained for screen positioning. * Refactor: Rename CursorPosition to InsertionPoint in TextField/DateField/TimeField (#4535) * Rename CursorPosition to InsertionPoint in history logic Standardize on "InsertionPoint" instead of "CursorPosition" throughout HistoryTextItemEventArgs and its consumers (TextField, TextView, etc). This includes renaming properties, updating all references, and revising documentation to clarify that InsertionPoint is a 0-based logical index. Also rename FinalCursorPosition to FinalInsertionPoint. Minor code style improvements applied. No functional behavior changes. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> |
||
|
|
07cee7174d |
Fixes #4471, #4474, #3714, #2588 - MASSIVE: Refactors Mouse, Adds ANSI driver, Enables Input Injection (#4472)
* Improve logging for debugging and error traceability
Enhanced logging across multiple classes to improve observability:
- Added debug log for `OperationCanceledException` in `MainLoopCoordinator<TInputRecord>`.
- Logged mouse event details in `MouseImpl` for better event tracking.
- Added trace log in `InputImpl<TInputRecord>` to indicate input availability.
- Replaced `LogInformation` with `Logging.Information` in `WindowsInput`.
- Logged detailed error information for console input failures in `WindowsInput`.
These changes enhance maintainability and debugging capabilities.
* Fixed warnings
* Refactored `MouseHeldDown` to support accelerating timeouts for
continuous actions like auto-scrolling. Enhanced `IMouseHeldDown`
to include richer event data and updated `Start` to accept
`MouseEventArgs`. Removed `MouseGrabHandler` and integrated its
functionality into `MouseHeldDown` and `MouseImpl`.
Streamlined mouse event handling in `View` by introducing lazy
instantiation of `MouseHeldDown` and replacing legacy methods
with `RaiseCommandsBoundToButtonClickedFlags` and
`RaiseCommandsBoundToWheelFlags`. Removed the `MouseWheel` event
and transitioned wheel handling to the command-binding system.
Improved `MouseBindings` to convert "pressed" events to "clicked"
events for better command invocation. Updated `TimedEvents` to
ensure proper handling of scheduled timeouts.
Refactored `MouseTests` to align with the new `MouseHeldDown`
implementation. Removed redundant code in `Button` and performed
general cleanup and documentation updates for better
maintainability.
* WIP: Refactor MouseFlags and improve mouse event handling
- Introduced semantic aliases for `MouseFlags` to improve readability.
- Enhanced XML documentation for `MouseFlags` and related enums.
- Refactored `MouseHeldDown` to improve type safety and add detailed logging.
- Updated `View.Mouse.cs` to handle mouse events more consistently.
- Changed default mouse bindings to use semantic aliases (e.g., `LeftButtonClicked`).
- Removed redundant and excessive logging across multiple files.
- Updated `Button` class and test cases to align with new mouse flag aliases.
- Improved handling of continuous button presses and mouse grab logic.
* WIP: Big code cleanup and reorg of Mouse processing helpers.
* WIP: Add comprehensive driver/input/output unit tests
Introduces a broad suite of new xUnit tests for Terminal.Gui's driver, input, and output subsystems under the DriverTests namespace. Tests cover keyboard mapping, mouse click detection, input processing (including Unicode/surrogate pairs), and output buffer behavior. Includes edge cases for modifiers, wide/combining characters, and mouse event quirks. Some tests document known limitations or are marked as skipped for future investigation. This significantly increases test coverage and documents both expected and legacy behaviors.
* New arch
* WIP: Implement timestamp-based multi-click detection with pending clicks
Added Timestamp property to MouseEventArgs. Refactored MouseButtonClickTracker and MouseInterpreter to use event timestamps. Updated all test constructors. MouseButtonClickTrackerTests: 17/17 passing. MouseInterpreterExtendedTests: 9/18 passing (9 need deferred-click assertion updates).
* Add implementation summary for timestamp-based multi-click detection
* WIP:
* Almost working - Geting single and double clicks but at least single works.
* Made MouseEventArgs.Position nullable to indicate it might not be set.
* MouseEventArgs -> Mouse
* API docs
* Renames.
* Code clean up and deep dive
* Docs
* tests
* More analysis
* fxied some tests
* Massive mouse nameing cleanup
* HighlightStates rename and code cleanup
* More renames
* Disabled broken tests with Skip = "Broken in #4474"
* Commented legacy
* Phase 2
* Add testable input and debug/test suite for UnixInput
Implemented ITestableInput<char> in UnixInput, enabling injection of synthetic keyboard and mouse events for robust unit testing. Overrode EnqueueKeyDownEvent and EnqueueMouseEvent in UnixInputProcessor to inject ANSI sequences for keys and mouse actions. Added comprehensive unit and debug tests for input injection, event sequencing, and ANSI code mapping. Included detailed driver input/output analysis documentation comparing all drivers and their use of native APIs and ANSI infrastructure. These changes greatly improve testability and cross-platform input simulation.
* Add AnsiKeyboardEncoder/MouseEncoder and related tests
Introduce AnsiKeyboardEncoder and AnsiMouseEncoder utility classes to convert Key and Mouse objects to ANSI escape sequences, enabling round-trip testing and input injection. Refactor UnixInputProcessor to use these encoders, removing legacy conversion methods. Add comprehensive AnsiKeyboardEncoderTests and remove obsolete MouseToAnsiDebugTests. Minor formatting improvements in AnsiKeyboardParser. These changes improve modularity and testability of ANSI input handling.
* merged
* Enabled previously skpped tests. STuff is broke
* updates transparent shadow test
* Refactor Fake driver to use pure ANSI char stream
Refactored the Fake (mock) driver to operate as a true ANSI driver using a char stream for input and output, replacing the previous ConsoleKeyInfo-based model. FakeInput now implements IInput<char> and ITestableInput<char>, reading raw bytes from Console.OpenStandardInput(), decoding as UTF-8, and parsing ANSI escape sequences for keyboard and mouse events. FakeInputProcessor is updated to process char streams and integrates with the ANSI parser infrastructure, supporting EnqueueKeyDownEvent and EnqueueMouseEvent via ANSI encoding.
FakeOutput now writes ANSI escape sequences directly to the console (if available) and maintains an internal buffer for test verification, supporting both 16-color and true-color output. All related tests and helpers are updated to use char-based input buffers and ScreenPosition for mouse events. Added a new FakeInputTestableTests.cs file for comprehensive testing of the ITestableInput<char> implementation.
Also updated launchSettings.json to add a "UICatalog --driver fake" profile. This modernizes the Fake driver for more realistic testing and compatibility with real ANSI terminals.
* Add platform raw mode support to FakeInput (Unix/Win)
Enables and restores terminal raw mode on Unix/Mac using termios
(P/Invoke), and enables Virtual Terminal Input mode on Windows
using Console API. Original terminal settings are restored on
shutdown. Updates class documentation to clarify platform-specific
behavior and limitations. Improves FakeInput for real ANSI input
on Unix-like systems and enhances Windows support, though with
noted caveats.
* Refactor FakeDriver: true ANSI/VT, platform helpers, size
- Introduce UnixRawModeHelper and WindowsVTInputHelper for robust, cross-platform raw/VT input handling.
- Refactor FakeInput and FakeOutput to use real ANSI/VT sequences, alternate buffer, and proper terminal state management.
- Add FakeSizeMonitor for ANSI-based terminal size detection using escape sequences and async response handling.
- Enhance ISizeMonitor with Initialize(driver) for post-construction setup.
- MainLoopCoordinator now initializes size monitor after driver construction.
- Update and clarify tests for ANSI/VT limitations and mouse/key round-tripping.
- OutputBase.ToAnsi emits plain text for legacy consoles.
- Add launch profiles for Fake driver on Windows and WSL.
- General code cleanup, improved comments, and platform separation.
* Unify ANSI key conversion for Unix and test drivers
Replaced UnixKeyConverter with new AnsiKeyConverter, consolidating ANSI char-to-Key mapping for both Unix and FakeInput drivers. Updated processors to use AnsiKeyConverter, removed UnixKeyConverter, and improved documentation for clarity. Reformatted WindowsVTInputHelper for consistency. This refactor ensures consistent, cross-platform ANSI input handling and reduces code duplication.
* Introduce DriverRegistry: type-safe, AOT-friendly driver system
Adds DriverRegistry for centralized, reflection-free driver discovery and selection. Refactors Application and driver factories to use registry-based logic and type-safe constants. Removes legacy string-based and reflection-based driver selection. Updates docs, tests, and schema for new pattern. Enables custom driver registration and improves AOT compatibility.
* Rename Fake driver to ANSI driver throughout codebase
Refactored all code, tests, docs, and configs to replace the "Fake" driver with the "ANSI" driver. This includes renaming all related classes, files, registry constants, and test helpers (e.g., FakeInput → ANSIInput, FakeOutput → ANSIOutput, etc.), and updating all references in documentation and configuration. No functional changes were made; this is a naming and documentation update to clarify that the ANSI driver is a real, cross-platform ANSI escape sequence driver suitable for both testing and actual use. The FakeClipboard utility remains unchanged.
* Rename ANSI* classes to Ansi* and update docs/references
Renamed ANSIInput, ANSIInputProcessor, ANSIOutput, and ANSISizeMonitor to AnsiInput, AnsiInputProcessor, AnsiOutput, and AnsiSizeMonitor for .NET naming consistency. Updated all references, type checks, and XML docs accordingly. Removed the "Extending the Driver System" section from drivers.md, including custom driver registration and implementation examples. No functional changes; this is a naming and documentation refactor.
* Merged and fixed warnings.
* Refine mouse click handling for UI controls
Standardize mouse interactions across controls: single left clicks now activate items (not accept), while double-clicks trigger accept actions. Removed or replaced default single-click bindings to prevent accidental state changes, especially in CheckBox and ColorBar. Improved movement and activation logic in ColorPicker16. These changes make mouse behavior more deliberate and consistent throughout the UI.
* deleted
* No changes detected
No code modifications were made in this commit.
* Rename Enqueue* APIs to Inject*; enhance ANSI key encoding
Renames all Enqueue* input injection APIs and test helpers to Inject* for clarity and consistency (e.g., EnqueueKeyEvent → InjectKeyEvent, AddInput → InjectInput). Updates all interfaces, implementations, and test usages accordingly. Improves AnsiKeyboardEncoder to support correct ANSI escape sequences for function/navigation keys with Shift, Ctrl, and Alt modifiers, including new helper methods and extensive new unit tests for modifier handling and round-trip parsing. Adds ApplicationKeyboardTests to verify integration of injected key events with the application and view event pipeline. Introduces InputTestHelpers for simulating input threads in tests. Updates documentation and comments to reflect new terminology. Refactors and clarifies related unit tests, and marks some as skipped due to known issues. Includes minor code cleanups and formatting improvements.
* Add comprehensive mouse event pipeline tests
Added ApplicationMouseTests.cs to thoroughly test the mouse event pipeline, including injection, ANSI encoding/decoding, input queue processing, and event routing through IApplication.Mouse and View.MouseEvent. Tests cover event propagation, flag and modifier handling, event ordering, mouse enter/leave, mouse state tracking, and disabled mouse scenarios.
Also added InjectAndProcessMouse helper methods to InputTestHelpers to streamline mouse event injection and processing in tests. These changes ensure robust automated coverage of mouse event handling throughout the application's input system.
* lame progress
* Add input injection redesign and fix click threshold bug
Introduce driver-input-injection-redesign.md, detailing a proposed overhaul of Terminal.Gui's input injection and testing architecture. The redesign includes a virtual time system, unified input injection API, refactored input/test architecture, simplified test helpers, and improved integration test support. A migration path and benefits summary are provided.
Add driver-input-injection.md to document the current input injection system, its architecture, and pain points, serving as a baseline for the redesign.
Fix a bug in MouseButtonClickTracker by changing the click threshold comparison from '>' to '>=' for correct double-click detection.
Update Button.OnMouseHoldRepeatChanged to properly manage mouse bindings when toggling hold repeat.
Apply minor formatting and #nullable directive adjustments in Button.cs.
Update ApplicationMouseTests.cs and InputTestHelpers.cs for consistent object initialization and clearer timestamp handling in mouse event injection.
These changes lay the foundation for a more robust, testable, and maintainable input system in Terminal.Gui.
* update input injection spec
Updated driver-input-injection-redesign.md with a comprehensive, implementation-ready specification: added an "AI Agent Prompt," expanded rationale and constraints, provided explicit coding standards, and included a detailed step-by-step implementation checklist. Clarified migration path, success criteria, and the status of disabled tests. The spec now fully supports the upcoming input injection redesign and test migration.
Marked mouse/keyboard input tests as skipped due to #4474, disabling them in ButtonTests, ScrollBarTests, OptionSelectorTests, and GuiTestContextMouseEventTests. Reformatted object initializations in ButtonTests for coding standards compliance.
* Revise mouse behavior specification for clarity
Updated the mouse behavior specification to clarify design principles, button types, and event handling. Added details on ClickCount, MouseHoldRepeat, and visual feedback for buttons.
* Initial plan
* Add core time abstraction and input source interfaces
- Created ITimeProvider, SystemTimeProvider, and VirtualTimeProvider
- Created IInputSource, TestInputSource, and ConsoleInputSource
- Created InputEventRecord types (keyboard, mouse, ANSI)
- All code follows Terminal.Gui coding standards
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add Input Injector infrastructure
- Created IInputInjector interface with injection modes
- Created InputInjector implementation
- Created InputInjectionExtensions for convenience methods
- Defined InputEvent, KeyEvent, and MouseEvent for sequences
- Integrated with existing IInputProcessor interface
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Update core components to use ITimeProvider
- Updated MouseInterpreter to use ITimeProvider instead of Func<DateTime>
- Updated MouseButtonStateEx to use ITimeProvider
- Updated AnsiResponseParserBase to use ITimeProvider
- All components now support virtual time for testing
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add validation tests for VirtualTimeProvider
- Created comprehensive tests for virtual time functionality
- Tests verify time advancement, delays, and timers
- All 7 tests passing successfully
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix code review feedback - capitalize Copilot comments
- Fixed capitalization of "CoPilot" to "Copilot" in test comments
- Addressing code review feedback
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fixed bug
* Fix merge conflicts and adapt to v2_4471-Continuous refactoring
- Updated MouseInterpreter to use ITimeProvider instead of Func<DateTime>
- Updated MouseButtonClickTracker to use ITimeProvider
- Changed MouseEventArgs references to Mouse class
- Updated InputInjector to use current IInputProcessor method names (InjectKeyDownEvent, InjectMouseEvent, RaiseMouseEventParsed, RaiseSyntheticMouseEvent)
- Fixed XML documentation warnings
- Build succeeds with 0 errors
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add FuncTimeProvider and update tests for ITimeProvider compatibility
- Created FuncTimeProvider helper class to wrap Func<DateTime> for backward compat
- Updated all mouse-related tests to use FuncTimeProvider
- Fixed 45+ test instances that were using lambda expressions
- All 7 VirtualTimeProvider tests passing
- Tests build successfully with 0 errors
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Add comprehensive tests for ANSI driver, input, and OSC 8
Introduced new xUnit test files covering the Terminal.Gui ANSI handling layer, including driver, input, parser, encoder, and OSC 8 hyperlinking. Tests verify keyboard and mouse parsing, driver resizing and buffer logic, clipboard, request/response scheduling, and robust URL hyperlink wrapping. All tests are parallelizable, cover edge cases, and improve maintainability of the ANSI infrastructure.
* Fixed namespace
* Fix: Update file name casing for ANSI driver files
* Refactor: add low-level driver tests and test base class
Adds comprehensive low-level and unit tests for Terminal.Gui's driver infrastructure, covering ANSI, Unix, .NET, and Windows backends. Tests include input/output construction, buffer handling, key/mouse event injection, and Unicode/wide character rendering. Introduces OutputBufferWideCharTests for #4466, and TestDriverBase for reusable test driver setup. All tests use xUnit and are organized for platform-specific execution, improving coverage and reliability of driver internals.
* disbled test that fails in GH runners sometimes.
* Phase 5 Part 1: Add ITimeProvider and test mode to Application layer
- Updated Application.Create() to accept optional ITimeProvider parameter
- Added Application.CreateForTesting() factory method with VirtualTimeProvider
- Updated ApplicationImpl constructor to accept ITimeProvider and testMode
- Added GetTimeProvider() method to IApplication interface
- Added GetTimeProvider() implementation in ApplicationImpl
- Build succeeds with 0 errors
Next: Pass ITimeProvider to components (MouseInterpreter, AnsiResponseParser) and wire up TestInputSource in test mode
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Phase 5 Part 2: Wire ITimeProvider through InputProcessor and AnsiResponseParser
- Updated InputProcessorImpl to accept ITimeProvider and pass to MouseInterpreter and AnsiResponseParser
- Updated all derived InputProcessors (Net, Windows, Unix, ANSI) to accept and forward ITimeProvider
- Updated AnsiResponseParserBase to accept ITimeProvider and use it instead of DateTime.Now
- Updated AnsiResponseParser<T> and AnsiResponseParser to pass ITimeProvider to base class
- Build succeeds with 0 errors
Next: Update component factories to accept and pass ITimeProvider, then wire up TestInputSource in test mode
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix build errors - add ITimeProvider to test instantiations
- Updated TestDriverBase to pass SystemTimeProvider to AnsiResponseParser and AnsiInputProcessor
- Fixed all test files to pass ITimeProvider (or null) to InputProcessor constructors
- Fixed AnsiResponseParser instantiations in test files to include SystemTimeProvider
- Updated AnsiResponseParserTests class fields and method instantiations
- Build succeeds with 0 errors
- All 7 VirtualTimeProvider tests pass
- All 15 MouseInterpreter tests pass
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Code cleanup.
* warnings
* Phase 5 Part 3: Wire ITimeProvider through component factories
- Updated IComponentFactory.CreateInputProcessor() to accept optional ITimeProvider parameter
- Updated ComponentFactoryImpl abstract class with new signature
- Updated all factory implementations (Ansi, Net, Unix, Windows) to pass ITimeProvider to InputProcessors
- Updated MainLoopCoordinator to accept and pass ITimeProvider to factory
- Updated ApplicationImpl.CreateSubcomponents to pass ITimeProvider to MainLoopCoordinator
- Fixed ApplicationImplTests mock setup for optional parameter in expression tree
- Build succeeds with 0 errors
- All 7 VirtualTimeProvider tests pass
Phase 5 complete: ITimeProvider now fully wired through application layer
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Phase 5 Complete + Phase 6: Input injection examples
Phase 5 completion:
- Added IApplication.GetInputInjector() method
- Added ApplicationImpl.GetInputInjector() implementation
- Added Application.CreateForTesting() factory method
- All infrastructure now complete and wired
Phase 6: Example tests demonstrating simplified API
- Created 7 comprehensive example tests showing new API benefits
- Examples cover: simple injection, virtual time, sequences, combinations, timing
- All 7 tests passing
- Tests demonstrate 60-70% code reduction vs old 3-step pattern
- Examples show deterministic, fast testing without Thread.Sleep
Build: ✅ 0 errors
Tests: ✅ 7/7 example tests passing, 7/7 VirtualTimeProvider tests passing
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Port GuiTestContext to use new input injection infrastructure
- Updated GuiTestContext to use VirtualTimeProvider for deterministic time control
- Ported InjectKeyEvent to use app.InjectKey() (new simplified API)
- Ported InjectMouseEvent to use app.InjectMouse() (new simplified API)
- Updated mouse timestamps to use virtual time instead of DateTime.Now
- Added TimeProvider property to expose VirtualTimeProvider for advanced test scenarios
- Added new ApplicationImpl constructor accepting IComponentFactory, ITimeProvider, and testMode
- All GuiTestContext tests pass (24/24 basic, 59/60 key events, 12/12 mouse events)
- Tests now benefit from virtual time control for deterministic, fast testing
Benefits:
- Tests execute with deterministic time - no more Thread.Sleep
- Virtual time allows testing time-dependent features (double-click, timeouts)
- Simplified injection API reduces test complexity
- Backward compatible - existing tests continue to work
Co-authored-by: tig <585482+tig@users.noreply.github.com>
* Fix GetTimeProvider extension method to delegate to interface
Fixed issue where InputInjectionExtensions had duplicate GetTimeProvider/GetInputInjector extension methods that conflicted with interface methods. Removed duplicates and kept only the convenience extension methods (InjectKey, InjectMouse, InjectSequence).
Note: 14 Menu/MenuBar tests are failing but these appear to be pre-existing issues not caused by the GuiTestContext porting. Tests were passing at commit
|
||
|
|
4145b984ba |
Fixes #2485 ++ - Wizard v2 architecture modernization with Padding-based layout (#4510)
* Initial plan * Fix Wizard v2 architecture issues - ScrollBar API, event handlers, key bindings Co-authored-by: tig <585482+tig@users.noreply.github.com> * Implement issue #4155 - Put nav buttons in bottom Padding, Help in right Padding Co-authored-by: tig <585482+tig@users.noreply.github.com> * Address code review feedback - Extract helper method, improve null checks Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix disposal issue - Ensure _helpTextView is always disposed Co-authored-by: tig <585482+tig@users.noreply.github.com> * Refactor & improvements. WIP * Tweaking layout * Wizard tweaks * Added View.GetSubViews that optinoally gets subviews of adornments * Refactor Wizard API: modern events, layout, and design - Replaced custom event args with standard .NET event args (CancelEventArgs, ValueChangingEventArgs, etc.) - Removed Finished event; use Accepting for wizard completion - Updated Cancelled, MovingBack, MovingNext to use CancelEventArgs - Refactored UICatalog scenarios and tests to new event model - Improved WizardStep sizing and wizard auto-resizing to content - Enhanced IDesignable for Wizard and WizardStep with richer design-time UI - Simplified help text padding logic in WizardStep - Removed obsolete code and modernized code style throughout - Improves API consistency, usability, and .NET idiomatic usage * Fixes #4515 - Navigating into and out of Adornments does not work * WIP. QUite broken. * All fixed? * Tweaks. * Exclude Margin subviews from drawing; add shadow tests Update Margin adornment to skip drawing subviews that are themselves Margin views, preventing unsupported nested Margin rendering. Add unit tests to verify that opaque-shadowed buttons in Margin are not drawn, while Border and Padding still support shadow rendering. Update test class to use output helper and assert driver output. * Final code cleanup and test improvements. * Update Margin.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update View.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update View.Hierarchy.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update View.Hierarchy.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Refactor: code style, formatting, and minor logic cleanup - Standardized spacing and formatting for method signatures and object initializations. - Converted simple methods and properties to expression-bodied members for conciseness. - Replaced named arguments with positional arguments for consistency. - Improved XML documentation formatting for readability. - Simplified logic in event handlers (e.g., Wizard Back button). - Removed redundant checks where properties are guaranteed to exist. - Fixed minor bugs related to padding, height calculation, and event handling. - Adopted consistent use of `var` for local variables. - Corrected namespace declarations. - Refactored methods returning constants to use expression-bodied syntax. - General code cleanup for clarity and maintainability; no breaking changes. * api docs --------- 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> |
||
|
|
0a9f4b8ef1 |
Fixes #4492, #4480 - Transparent shadows cause underlying wide glyph rendering issues (#4490)
* WIP - experiments in fixing shadow rendering issues based on #4465 Previously, shadow size was fixed at 1x1. This change introduces ShadowWidth and ShadowHeight properties to both Margin and View, allowing variable shadow dimensions. The Margin class now manages its own shadow sizing, enforcing valid values based on ShadowStyle (e.g., Opaque and Transparent require a minimum of 1, and Opaque only allows 1). Margin.Thickness is dynamically adjusted to account for shadow size, with original values preserved and restored as needed. ShadowView rendering is updated to correctly handle wide graphemes (such as emojis) in the shadow area, preventing rendering errors. The View class exposes ShadowWidth and ShadowHeight, synchronizing with Margin. Extensive new unit tests verify correct behavior for shadow sizing, style changes, thickness adjustments, and rendering, including edge cases and visual output. Additional minor bug fixes and refactoring are included, such as proper management of Margin's cached clip region and correcting a loop order bug in ShadowView. The codebase is also modernized with recent C# features. * more merge * added border tests * Experiment... * Incorporated latest wideglyphs * Comment tweaks * Add Adornments and ViewportSettings editors to WideGlyphs Introduce AdornmentsEditor and ViewportSettingsEditor with custom border styles and positioning, enhancing UI editing capabilities. Also update arrangeableViewAtEven to use Color.Black and Color.Green, and adjust a commented border style from Dashed to Dotted. * Fix scenario editors and tweak scenarios. Enhance ShadowStyles with a second shadow window (transparent style) and a button event handler that shows a message box. In WideGlyphs, add AdornmentsEditor and ViewportSettingsEditor for view property editing, apply custom color schemes to arrangeable views, and update superView with a transparent shadow and increased shadow width. These changes improve interactivity and visualization in the demo scenarios. * Fix scenario editors and tweak scenarios. Enhance ShadowStyles with a second shadow window (transparent style) and a button event handler that shows a message box. In WideGlyphs, add AdornmentsEditor and ViewportSettingsEditor for view property editing, apply custom color schemes to arrangeable views, and update superView with a transparent shadow and increased shadow width. These changes improve interactivity and visualization in the demo scenarios. * Make replacement char themeable via Glyphs.ReplacementChar Adds Glyphs.ReplacementChar as a configurable replacement character, replacing all uses of Rune.ReplacementChar. The default is now a space (' ') and can be set via config.json. Updates all rendering, string decoding, and buffer invalidation logic to use the new property, ensuring consistency and themeability. Updates tests and comments accordingly. Also includes minor UI tweaks in WideGlyphs.cs and .DotSettings updates. * merging * merge errors * merged * merged * Refactor shadow properties to Margin; update tests ShadowWidth and ShadowHeight are now managed solely in the Margin class, with related properties and validation logic removed from View. All code and tests now use view.Margin.ShadowWidth/ShadowHeight. Tests and documentation were updated accordingly, and wide glyph handling in test output was improved for consistency. * Simplify ShadowSize; remove it from View as it's infreqnetly used. Make it a Size to reduce API surface area. Replace ShadowWidth/ShadowHeight with a single ShadowSize property (of type Size) in the Margin class and related code. Update all usages, validation logic, and tests to use ShadowSize.Width and ShadowSize.Height. Introduce TryValidateShadowSize for unified validation. Modernize code with C# features and improve clarity and maintainability by treating shadow dimensions as a single unit. * reveted * Fix wide glyph attribute handling for second column Ensure the attribute for the second column of wide glyphs is set correctly when within the clip region, addressing issues #4258 and #4492. Add comprehensive unit tests to verify correct attribute assignment and output rendering, including scenarios with transparent shadows. Remove obsolete test code for clarity. This improves color/style consistency for wide glyphs, especially in overlapping UI situations. * added url |
||
|
|
fb1a3e03f3 |
Fixes some bugs in the Scenario/EditorsAndHelpers and backports WideGlyphs (#4494)
* Fix scenario editors and tweak scenarios. Enhance ShadowStyles with a second shadow window (transparent style) and a button event handler that shows a message box. In WideGlyphs, add AdornmentsEditor and ViewportSettingsEditor for view property editing, apply custom color schemes to arrangeable views, and update superView with a transparent shadow and increased shadow width. These changes improve interactivity and visualization in the demo scenarios. * Fix scenario editors and tweak scenarios. Enhance ShadowStyles with a second shadow window (transparent style) and a button event handler that shows a message box. In WideGlyphs, add AdornmentsEditor and ViewportSettingsEditor for view property editing, apply custom color schemes to arrangeable views, and update superView with a transparent shadow and increased shadow width. These changes improve interactivity and visualization in the demo scenarios. * Scenario Editors code cleanup & latent bug fixes. Refactored event handler patterns to use correct sender values and discards for unused parameters, aligning with .NET conventions. Cleaned up code by removing redundant usings and comments, and clarified logic in property setters and switch statements. Enhanced robustness and clarity in editor components, fixing issues with value changes, event subscriptions, and nullability. Improved disposal logic in EditorBase and made minor UI and label adjustments. Added "diag" to the custom dictionary. These changes modernize event handling and address subtle bugs in the UICatalog editors. * code cleanup * Update Examples/UICatalog/Scenarios/EditorsAndHelpers/EditorBase.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * PR feedback. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
48d6e13138 |
Fixes #4466 - FillRect Corrupts Wide Characters When Overlapping (#4486)
* Improve wide character handling in output buffer Enhances rendering and state management for wide (double-width) characters. Marks both cells as clean after rendering wide graphemes, ensures replacement cells are marked dirty when partially clipped, and uses Move/AddStr for proper wide character handling and invalidation. * Fix FillRect to handle wide Unicode chars correctly Refactored OutputBufferImpl.FillRect to properly handle wide (double-width) Unicode characters, fixing visual corruption when overwriting CJK text (e.g., with MessageBox borders). Removed the char-based FillRect overload in favor of Rune-based handling. Added helper methods for attribute/dirty management and wide glyph invalidation. Updated OutputBase.Write to always mark adjacent cells dirty for wide chars. Updated tests and added OutputBufferWideCharTests to verify correct behavior in all scenarios. This resolves issue #4466 and ensures robust rendering for wide Unicode text. * Handle wide grapheme clusters in OutputBase rendering Added logic to mark both cells of wide grapheme clusters as clean after rendering, preventing unnecessary redraws. Also included a commented-out preprocessor directive and using statement for potential future use. * Clarify comment for IsDirty logic on wide graphemes Updated the comment explaining why the next cell is marked clean (IsDirty = false) after handling wide graphemes, and added a reference to GitHub issue #4466 for context. * Update test for dirty flag after wide glyph write Adjusted OutputBaseTests to expect column 1's dirty flag to be cleared after writing a wide glyph to column 0, matching current OutputBase.Write behavior. Added clarifying comment and GitHub issue reference. * Update Tests/UnitTestsParallelizable/Drivers/OutputBufferWideCharTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Terminal.Gui/Drivers/OutputBufferImpl.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Terminal.Gui/Drivers/OutputBase.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> |
||
|
|
d303943809 |
Fixes #4004 & #4445 - Merge of Application.ForceDriver and Driver.Force16Colors and windows" broken in conhost and cmd (#4448)
* Fixes #4004. Driver "windows" broken in conhost and cmd
* Fix unit tests
* Remove IsVirtualTerminal from IApplication. Add IDriverInternal and IOutputInternal interfaces
* Fix result.IsSupported
* Remove internal interfaces and add them in the implementations classes
* Move Sixel from IApplication to IDriver interface it's a characteristic of the driver
* Only if IOutput is OutputBase then set the internal properties
* Prevents driver windows error on Unix system
* Fix scenario sixel error
* Comment some tests because is keyboard layout dependent and shifted key is needed to produce them (Pt)
* Add 🇵🇹 regional indicators test proving they ca be joined as only one grapheme
* SetConsoleActiveScreenBuffer is already called by the constructor and is only needed once
* Finally fixed non virtual terminal in windows driver
* Add more Sixel unit tests
* Add unit tests for OutputBase class
* Avoid emit escape sequence
* Fix assertion failure in UICatalog
* Let each driver to deal with the Sixel write
* When Shutdown is called by the static Application then the ApplicationImpl.ResetStateStatic should be also called
* Add more OutputBase with Sixel unit tests
* Fix some issues with IsVirtualTerminal and Force16Colors with unit tests improvement
* Add Sixel Detect method unit test
* Make Sixel IsSupported and SupportsTransparency consistent with more unit tests
* Fix namespaces and unit test
* Covering more ApplicationImpl Sixel unit test
* Remove DriverImplProxy because sometimes fails in parallel unit tests
* Fix Init_KeyBindings_Are_Not_Reset unit test failing
* Revert "Fix Init_KeyBindings_Are_Not_Reset unit test failing"
This reverts commit
|
||
|
|
6d53276be2 |
Fixes #4289 - Simplify Drawing/Color: unify named color handling under StandardColor and remove layered resolvers (#4432)
* Initial plan * Delete AnsiColorNameResolver and MultiStandardColorNameResolver, add legacy 16-color names to StandardColor Co-authored-by: tig <585482+tig@users.noreply.github.com> * Refactor and enhance tests for Color, Region, and Lines Refactored `Color` struct by removing unused methods and simplifying logic. Updated namespaces for better organization. Enhanced test coverage for `Color`, `Region`, and `LineCanvas` with new test cases, parameterized tests, and edge case handling. Added `StraightLineExtensionsTests`, `StraightLineTests`, and `RegionClassTests` to validate behavior under various scenarios. Improved `MergeRectangles` stability and addressed crash patterns. Removed legacy features and unused code. Enhanced documentation and optimized performance in key methods. * Improve Color struct and StandardColors functionality Enhanced the Color struct to fully support the alpha channel for rendering intent while maintaining semantic color identity. Updated TryNameColor to ignore alpha when matching colors, ensuring transparency does not affect color resolution. Expanded XML documentation to clarify alpha channel usage and future alpha blending support. Improved drawing documentation to explain the lifecycle, deferred rendering, and color support, including 24-bit true color and legacy 16-color compatibility. Added a new section on transparency and its role in rendering. Revised StandardColors implementation to use modern C# features and ensure consistent ARGB mapping. Added comprehensive tests for StandardColors and Color, covering alpha handling, color parsing, thread safety, and aliased color resolution. Removed outdated tests relying on legacy behavior. Enhanced code readability, maintainability, and test coverage to ensure correctness and backward compatibility. * Code cleanup * Code cleanup * Fix warnings. Code cleanup * Add comprehensive unit tests for ColorStrings class Introduced a new test class `ColorStringsTests` under the `DrawingTests.ColorTests` namespace to validate the functionality of the `ColorStrings` class. Key changes include: - Added tests for `GetColorName` to verify behavior for standard and non-standard colors, ignoring alpha channels, and handling known colors. - Added tests for `GetStandardColorNames` to ensure the method returns a non-empty, alphabetically sorted collection containing all `StandardColor` enum values. - Implemented tests for `TryParseStandardColorName` to validate case-insensitive parsing, hex color support, handling invalid input, and `ReadOnlySpan<char>` compatibility. - Added tests for `TryParseNamedColor` to verify parsing of named and hex colors, handling of aliases, and `ReadOnlySpan<char>` support. - Added round-trip tests to ensure consistency between `GetColorName`, `TryParseNamedColor`, `GetStandardColorNames`, and `TryParseStandardColorName`. These tests ensure robust validation of color parsing and naming functionality. --------- 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> |
||
|
|
a84b2c4896 |
Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422)
* WIP: Broken
* Got working. Mostly.
* Parllel tests pass
* More progres
* Fixed app tests.
* Mouse
* more progress.
* working on shortcut
* Shortcut accept on ENTER is broken.
* One left...
* More test progress.
* All unit tests pass. Still some issues though.
* tweak
* Fixed Integration Tests
* Fixed UI Catalog
* Tweaking CP to try to find race condition
* Refactor StandardColors and improve ColorPicker logic
Refactored `StandardColors` to use lazy initialization for static fields, improving performance and avoiding static constructor convoy effects. Introduced `NamesValueFactory` and `MapValueFactory` methods for encapsulated initialization logic.
Simplified `GetColorNames` to directly return `_names.Value`. Improved `TryParseColor` by clarifying default value usage and adopting object initializer syntax. Updated `TryNameColor` to use `_argbNameMap.Value`.
Refactored `GetArgb` for better readability. Replaced `MultiStandardColorNameResolver` with `StandardColorsNameResolver` in `ColorPicker`. Commented out `app.Init("Fake")` in `ColorPickerTests` for testing purposes.
Made minor formatting improvements, including updated comments and XML documentation for consistency.
* revert
* Throttle input loop to prevent CPU spinning
Introduce a 20ms delay in the input loop of `InputImpl<TInputRecord>`
to prevent excessive CPU usage when no input is available. Removed
the `DateTime dt = Now();` line and the `while (Peek())` block, which
previously enqueued input records.
This change improves resource management, especially in scenarios
where multiple `ApplicationImpl` instances are created in parallel
tests without calling `Shutdown()`. It prevents thread pool
exhaustion and ensures better performance in such cases.
* Refactor ApplicationImpl to use IDisposable pattern
Implemented the IDisposable pattern in ApplicationImpl to improve resource management. Added `Dispose` and `DisposeCore` methods, and marked the `Shutdown` method as obsolete, encouraging the use of `Dispose` or `using` statements instead. Updated the `IApplication` interface to inherit from IDisposable and added `GetResult` methods for retrieving run session results.
Refactored unit tests to adopt the new lifecycle management approach, replacing legacy `Shutdown` calls with `Dispose` or `using`. Removed fragile and obsolete tests, and re-enabled previously skipped tests after addressing underlying issues.
Updated `FakeApplicationLifecycle` and `SetupFakeApplicationAttribute` to align with the new disposal pattern. Improved documentation and examples to guide users toward modern usage patterns. Maintained backward compatibility for legacy singleton usage.
* Add IDisposable pattern with input loop throttling
- Add IDisposable to IApplication for proper resource cleanup
- Add 20ms throttle to input loop (prevents CPU spinning)
- Add Lazy<T> to StandardColors (eliminates convoy effect)
- Add MainLoopCoordinatorTests suite (5 new tests)
- Add Dispose() calls to all 16 ColorPickerTests
- Mark Application.Shutdown() as [Obsolete]
IApplication now requires Dispose() for cleanup
Performance: 100x CPU reduction, 15x faster disposal, tests complete in <5s
Fixes: Thread leaks, CPU saturation, test hangs in parallel execution
Docs: Updated application.md and newinv2.md with disposal patterns
* Refactor test for input loop throttling clarity
Updated `InputLoop_Throttle_Limits_Poll_Rate` test to improve clarity, reliability, and efficiency:
- Rewrote summary comment to clarify purpose and emphasize the 20ms throttle's role in preventing CPU spinning.
- Replaced `var` with explicit types for better readability.
- Reduced test duration from 1s to 500ms to improve test speed.
- Revised assertions:
- Replaced range-based assertion with upper-bound check to ensure poll count is below 500, avoiding timing sensitivity issues.
- Added assertion to verify the thread ran and was not immediately canceled.
- Added a 2-second timeout to `inputTask.Wait` and verified task completion.
- Improved comments to explain test behavior and reasoning behind changes.
* tweaks
* Fix nullabiltiy stuff.
* runnable fixes
* more nullabe
* More nullability
* warnings gone
* Fixed fluent test failure.
* Refactor ApplicationImpl and update Runnable layout logic
Refactored `ApplicationImpl.Run.cs` for improved readability and
atomicity:
- Combined `if (wasModal)` with `SessionStack?.TryPop` to streamline
logic.
- Simplified restoration of `previousRunnable` by reducing nesting.
- Updated comments for clarity and retained `SetIsModal` call.
Simplified focus-setting logic in `ApplicationImpl.Run.cs` using
pattern matching for `TopRunnableView`.
In `Runnable<TResult>`, added `SetNeedsLayout` after `IsModalChanged`
to ensure layout updates. Removed an unused empty line for cleanup.
Corrected namespace in `GetViewsUnderLocationForRootTests.cs` to
align with test structure.
* Update layout on modal state change
A call to `SetNeedsLayout()` was added to the `OnIsModalChanged`
method in the `Runnable` class. This ensures that the layout
is updated whenever the modal state changes.
* Increase test timeout for inputTask.Wait to 10 seconds
Extended the timeout duration for the `inputTask.Wait` method
from 4 seconds to 10 seconds in `MainLoopCoordinatorTests`.
This change ensures the test has a longer window to complete
under conditions of increased load or slower execution
environments, reducing the likelihood of false test failures.
* Refactor project files and simplify test logic
Removed `<LangVersion>` and `<ImplicitUsings>` properties from
`UnitTests.csproj` and `UnitTests.Parallelizable.csproj` to rely
on default SDK settings and disable implicit global usings.
Simplified the `SizeChanged_Event_Still_Fires_For_Compatibility`
test in `FakeDriverTests` by removing the `screenChangedFired`
variable, its associated event handler, and related assertions.
Also removed obsolete warning suppression directives as they
are no longer needed.
* Reduce UnitTestsParallelizable iterations from 10 to 3
Reduced the number of iterations for the UnitTestsParallelizable
test suite from 10 to 3 to save time and resources while still
exposing concurrency issues. Updated the loop and log messages
to reflect the new iteration count.
* disabled InputLoop_Throttle_Limits_Poll_Rate
* Refactor app lifecycle and improve Runnable API
Refactored `Program.cs` to simplify application lifecycle:
- Modularized app creation, initialization, and disposal.
- Improved result handling and ensured proper resource cleanup.
Re-implemented `Runnable<TResult>` with a cleaner design:
- Retained functionality while improving readability and structure.
- Added XML documentation and followed the Cancellable Work Pattern.
Re-implemented `RunnableWrapper<TView, TResult>`:
- Enabled wrapping any `View` to make it runnable with typed results.
- Added examples and remarks for better developer guidance.
Re-implemented `ViewRunnableExtensions`:
- Provided fluent API for making views runnable with or without results.
- Enhanced documentation with examples for common use cases.
General improvements:
- Enhanced code readability, maintainability, and error handling.
- Replaced redundant code with cleaner, more maintainable versions.
* Modernize codebase for Terminal.Gui and MVVM updates
Refactored `LoginView` to remove redundant `Application.LayoutAndDraw()`
call. Enhanced `LoginViewModel` with new observable properties for
automatic property change notifications. Updated `Message` class to use
nullable generics for improved type safety.
Replaced legacy `Application.Init()` and `Application.Run()` calls with
the modern `IApplication` API across `Program.cs`, `Example.cs`, and
`ReactiveExample`. Ensured proper disposal of `IApplication` instances
to prevent resource leaks.
Updated `TerminalScheduler` to integrate with `IApplication` for
invoking actions and managing timeouts. Added null checks and improved
timeout disposal logic for robustness.
Refactored `ExampleWindow` for better readability and alignment with
modern `Terminal.Gui` conventions. Cleaned up unused imports and
improved code clarity across the codebase.
Updated README.md to reflect the latest `Terminal.Gui` practices,
including examples of the `IApplication` API and automatic UI refresh
handling. Renamed `LoginAction` to `LoginActions` for consistency.
* Refactor: Transition to IRunnable-based architecture
Replaced `Toplevel` with `Window` as the primary top-level UI element. Introduced the `IRunnable` interface to modernize the architecture, enabling greater flexibility and testability. Deprecated the static `Application` class in favor of the instance-based `IApplication` model, which supports multiple application contexts.
Updated methods like `Application.Run()` and `Application.RequestStop()` to use `IRunnable`. Removed or replaced legacy `Modal` properties with `IsModal`. Enhanced the `IApplication` interface with a fluent API, including methods like `Run<TRunnable>()` and `GetResult<T>()`.
Refactored tests and examples to align with the new architecture. Updated documentation to reflect the instance-based model. Deprecated obsolete members and methods, including `Application.Current` and `Application.TopRunnable`.
Improved event handling by replacing the `Accept` event with `Accepting` and using `e.Handled` for event processing. Updated threading examples to use `App?.Invoke()` or `app.Invoke()` for UI updates. Cleaned up redundant code and redefined modal behavior for better consistency.
These changes modernize the `Terminal.Gui` library, improving clarity, usability, and maintainability while ensuring backward compatibility where possible.
* Refactor: Replace Toplevel with Runnable class
This commit introduces a major architectural update to the `Terminal.Gui` library, replacing the legacy `Toplevel` class with the new `Runnable` class. The changes span the entire codebase, including core functionality, tests, documentation, and configuration files.
- **Core Class Replacement**:
- Replaced `Toplevel` with `Runnable` as the base class for modal views and session management.
- Updated all references to `Toplevel` in the codebase, including constructors, methods, and properties.
- **Configuration Updates**:
- Updated `tui-config-schema.json` to reflect the new `Runnable` scheme.
- **New Classes**:
- Added `UICatalogRunnable` for managing the UI Catalog application.
- Introduced `Runnable<TResult>` as a generic base class for blocking sessions with result handling.
- **Documentation and Tests**:
- Updated documentation to emphasize `Runnable` and mark `Toplevel` as obsolete.
- Refactored test cases to use `Runnable` and ensure compatibility.
- **Behavioral Improvements**:
- Enhanced lifecycle management and alignment with the `IRunnable` interface.
- Improved clarity and consistency in naming conventions.
These changes modernize the library, improve flexibility, and provide a clearer architecture for developers.
* Refactor: Consolidate Runnable classes and decouple View from ApplicationImpl
- Made Runnable<TResult> inherit from Runnable (eliminating ~180 LOC duplication)
- Moved View init/layout/cursor logic from ApplicationImpl to Runnable lifecycle events
- ApplicationImpl.Begin now operates purely on IRunnable interface
Related to #4419
* Simplified the disposal logic in `ApplicationImpl.Run.cs` by replacing
the type-specific check for `View` with a more general check for
`IDisposable`. This ensures proper disposal of any `IDisposable`
object, improving robustness.
Removed the `FrameworkOwnedRunnable` property from the `ApplicationImpl`
class in `ApplicationImpl.cs` and the `IApplication` interface in
`IApplication.cs`. This eliminates the need to manage this property,
reducing complexity and improving maintainability.
Updated `application.md` to reflect the removal of the
`FrameworkOwnedRunnable` property, ensuring the documentation aligns
with the updated codebase.
* Replaces the legacy `Shutdown()` method with `Dispose()` to align
with the `IDisposable` pattern, ensuring proper resource cleanup
and simplifying the API. The `Dispose()` method is now the
recommended way to release resources, with `using` statements
encouraged for automatic disposal.
Key changes:
- Marked `Shutdown()` as obsolete; it now internally calls `Dispose()`.
- Updated the fluent API to remove `Shutdown()` from chaining.
- Enhanced session lifecycle management for thread safety.
- Updated tests to validate proper disposal and state reset.
- Improved `IRunnable` integration with automatic disposal for
framework-created runnables.
- Maintained backward compatibility for the legacy static
`Application` singleton.
- Refactored documentation and examples to reflect modern practices
and emphasize `Dispose()` usage.
These changes modernize the `Terminal.Gui` lifecycle, improve
testability, and encourage alignment with .NET conventions.
* Refactor runnable app context handling in ApplicationImpl
Refactor how the application context is set for `runnable` objects
by introducing a new `SetApp` method in the `IRunnable` interface.
This replaces the previous logic of directly setting the `App`
property for `View` objects, making the process more generic and
encapsulated within `IRunnable` implementations.
Simplify `Mouse.UngrabMouse()` by removing the conditional check
and calling it unconditionally.
Make a minor formatting adjustment in the generic constraint of
`Run<TRunnable>` in `ApplicationImpl`.
Add `SetApp(IApplication app)` to the `IRunnable` interface and
implement it in the `Runnable` class to set the `App` property
to the provided application instance.
* Improve docs, tests, and modularity across the codebase
Reorganized and updated `CONTRIBUTING.md`:
- Added **Key Architecture Concepts** section and reordered the table of contents.
- Updated testing requirements to discourage legacy patterns.
- Added instructions for replicating CI workflows locally.
- Clarified PR guidelines and coding style expectations.
Enhanced `README.md` with detailed CI/CD workflow documentation.
Refactored `ColorPicker.Prompt` to use `IApplication` for improved modularity and testability.
Introduced `IApplicationScreenChangedTests` for comprehensive testing of `ScreenChanged` events and `Screen` property.
Refactored `ApplicationScreenTests` and `TextView.PromptForColors` to align with modern patterns.
Updated `Terminal.sln` to include `.github/workflows/README.md`.
Performed general cleanup:
- Removed outdated documentation links.
- Improved XML documentation and coding consistency.
* readme tweaks
* Improve thread safety, layout, and test coverage
Refactored `OutputBufferImpl.cs` to enhance thread safety by locking shared resources and adding bounds checks for columns and rows. Improved handling of wide characters and removed outdated TODO comments.
Updated `Runnable.cs` to call `SetNeedsDraw()` on modal state changes, ensuring proper layout and drawing updates. Simplified layout handling in `ApplicationImpl.Run.cs` by replacing redundant comments with a `LayoutAndDraw()` call.
Added a check in `AllViewsTester.cs` to skip creating instances of `RunnableWrapper` types with unsatisfiable generic constraints, logging a warning when encountered.
Enhanced `ListViewTests.cs` by adding explicit `app.LayoutAndDraw()` calls to validate visual output and ensure tests reflect the updated application state.
These changes improve robustness, prevent race conditions, and ensure consistent behavior across the application.
* Refactor: Rename Toplevel to Runnable and update logic
Updated the `Border` class to use `Command.Quit` instead of
`Command.QuitToplevel` in the `CloseButton.Accept` handler.
Renamed test methods in `GetViewsAtLocationTests.cs` to replace
"Toplevel" with "Runnable" for consistency. Updated `Runnable<bool>`
instances to use "topRunnable" as the `Id` property.
These changes align the codebase with updated naming conventions
and improve clarity.
* Removed `ToplevelTests` and migrated relevant test cases to
`MouseDragTests` with improved structure and coverage. Updated
tests to use `Application.Create`, `app.Begin`, and `app.End`
for better resource management and lifecycle handling.
Replaced direct event handling with `app.Mouse.RaiseMouseEvent`
to align with the application's event-handling mechanism. Added
`Runnable` objects to ensure views are properly initialized and
disposed of within the application context.
Enhanced tests to include assertions for minimum width and
height constraints during resize operations. Removed redundant
tests and streamlined logic to reduce duplication and improve
maintainability.
* Reorged Unit Test namespaces.
* more
* Refactor tests and update namespaces for consistency
Updated namespaces in `ArrangementTests.cs` and `MouseDragTests.cs` for better organization. Enhanced `ArrangementTests.cs` with additional checks for arrangement flags. Reformatted and re-added `MouseDragTests.cs` and `SchemeTests.cs` with modern C# features like nullable annotations and object initializers. Ensured no functional changes while improving code clarity and consistency.
* Fix nullability warnings in MouseDragTests.cs
Updated `app.End` calls to use the null-forgiving operator (`!`)
on `app.SessionStack` to ensure it is treated as non-null.
This change addresses potential nullability warnings and
improves code safety and clarity. Applied consistently across
all relevant test cases in the `MouseDragTests` class.
|
||
|
|
e199063a31 |
Introduce IRunnable interface architecture with Fluent API (Phase 1) (#4405)
* Initial plan * Add IRunnable interface, Runnable base class, and RunnableSessionToken Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add comprehensive parallelizable unit tests for IRunnable Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add 41 more unit tests for comprehensive IRunnable coverage - Added ApplicationRunnableIntegrationTests with 29 integration tests covering Begin/End/Run lifecycle - Added RunnableEdgeCasesTests with 24 edge case and error condition tests - Tests cover event propagation, cancellation scenarios, nested runnables, result handling - Fixed App property not being set in Begin() method - Total test count increased from 23 to 64 tests for IRunnable functionality Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix parallel test failures in CI/CD - Fixed IsModal property to check RunnableSessionStack instead of just TopRunnable - Added "fake" driver parameter to Application.Init() in integration tests - Fixed Begin() to capture old IsModal value before pushing to stack - Moved App property assignment before stack operations to ensure proper state - Skipped 2 tests that use Run() with main loop (not suitable for parallel tests) - All 11,654 parallelizable tests now pass (4 skipped) Co-authored-by: tig <585482+tig@users.noreply.github.com> * Refactor Application with IRunnable and session management Modernized `Application` and `ApplicationImpl` by introducing `IRunnable` and `RunnableSessionToken` for improved session management. Deprecated legacy methods and added `Obsolete` attributes to indicate their removal. Simplified method bodies using expression-bodied members and null-coalescing assignments. Enhanced lifecycle management in `ApplicationImpl` by removing redundant code and improving `SessionStack` iteration. Introduced `IToplevelTransitionManager` to handle top-level state changes. Updated `Runnable<TResult>` to implement `IRunnable<TResult>` with lifecycle event handling for `IsRunning` and `IsModal` states. Improved result management during lifecycle transitions. Removed legacy classes like `SessionToken` and consolidated their functionality into the new constructs. Updated and expanded the test suite to cover `IRunnable` lifecycle events, `RunnableSessionToken` behavior, and integration with `Application`. Performed code cleanup, improved readability, and updated documentation with detailed remarks and examples. Added new unit tests for edge cases and lifecycle behavior. * Implement fluent API for Init/Run/Shutdown with automatic disposal - Changed Init() to return IApplication for fluent chaining - Changed Run<TRunnable>() to return IApplication (breaking change from TRunnable) - Changed Shutdown() to return object? (extracts and returns result from last Run<T>()) - Added FrameworkOwnedRunnable property to track runnable created by Run<T>() - Shutdown() automatically disposes framework-owned runnables - Created FluentExample demonstrating: Application.Create().Init().Run<ColorPickerView>().Shutdown() - Disposal semantics: framework creates → framework disposes; caller creates → caller disposes Co-authored-by: tig <585482+tig@users.noreply.github.com> * New Example: Demonstrates new Fluent API using ColorPicker Conditional compilation (`#if POST_4148`) to support both a new Fluent API and a traditional approach for running `ColorPickerView`. The Fluent API simplifies the application lifecycle with method chaining and automatic disposal, while the traditional approach retains explicit lifecycle management. Refactor `ColorPickerView` to support both approaches: - Add an `instructions` label for user guidance. - Replace `_okButton` and `_cancelButton` with local `Button` instances. - Use a new `ColorPicker` with enhanced styling options. Add a warning log for WIP issue (#4148) in `ApplicationImpl.Run.cs` to highlight limitations with non-`Toplevel` views as runnables. Update `Terminal.sln` to include the new `FluentExample` project with appropriate build configurations. Improve code readability with verbatim string literals and better alignment/indentation. * Introduce `RunnableWrapper` for making any View runnable Added the `RunnableWrapper<TView, TResult>` pattern to enable any `View` to be run as a blocking session with typed results, without requiring inheritance from `Runnable<TResult>` or implementation of `IRunnable<TResult>`. - Added `RunnableWrapperExample` project to demonstrate usage. - Introduced `ApplicationRunnableExtensions` and `ViewRunnableExtensions` for clean, type-safe APIs to run views with or without result extraction. - Updated `CodeSharingStrategy.md` to document reduced duplication using `#if POST_4148` directives. - Added `RunnableWrapper.md` with detailed documentation and examples. - Created runnable examples in `Program.cs` showcasing various use cases. - Improved maintainability by reducing code duplication by 86% and increasing shared code by 264%. - Gated all new functionality behind the `POST_4148` feature flag for backward compatibility. * Simplified `#if POST_4148` usage to reduce duplication and improve clarity. Refactored `RunnableWrapper` to use a parameterless constructor with `required` properties, ensuring type safety and better lifecycle management. Updated `AllViewsView` with new commands, improved generic handling, and enhanced logging. Refactored `ApplicationRunnableExtensions` and `ViewRunnableExtensions` for cleaner initialization and event handling. Enhanced `TestsAllViews` to handle required properties and constraints dynamically. Updated documentation to reflect new designs and provide clearer examples. Improved overall code readability, consistency, and maintainability while leveraging modern C# features. * Update docfx documentation for IRunnable architecture - Updated View.md with comprehensive IRunnable section - Interface-based architecture explanation - Fluent API patterns and examples - Disposal semantics ("whoever creates it, owns it") - Result extraction patterns - Lifecycle properties and CWP-compliant events - Marked legacy Modal Views section for clarity - Updated application.md with IRunnable deep dive - Key features and benefits - Fluent API patterns with method chaining - Disposal semantics table - Creating runnable views with examples - Lifecycle properties and events - RunnableSessionStack management - Updated IApplication interface documentation - Updated runnable-architecture-proposal.md - Marked Phase 1 as COMPLETE ✅ - Updated status to "Phase 1 Complete - Phase 2 In Progress" - Documented all implemented features - Added bonus features (fluent API, automatic disposal) - Included migration examples All documentation is now clear, concise, and complete relative to Phase 1 implementation. Co-authored-by: tig <585482+tig@users.noreply.github.com> --------- Co-authored-by: Tig <tig@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tig <585482+tig@users.noreply.github.com> |
||
|
|
a6258ed398 |
Updates IListDataSource.Render to rename the start parameter to viewportXOffset (#4392)
* 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> |
||
|
|
d53fcd7485 | Fixes #4374 - Nukes all (?) legacy Driver and Application stuff; revamps tests (#4376) | ||
|
|
b502471ee6 |
Fixes #4300 - Scrolling intermittently causes All_Scenarios_Quit_And_Init_Shutdown_Properly to fail (#4301)
* 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
|
||
|
|
2be8397203 |
Remove legacy drivers, simplify architecture, and reorganize codebase structure (#4270)
* 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> |
||
|
|
764a804ddd | Fixes #3209 - Formalize Cancellable Work Pattern and add helpers (#4092) | ||
|
|
3e2eebfd2c |
Fixes #4057 - MASSIVE! Fully implements ColorScheme->Scheme + VisualRole + Colors.->SchemeManager. (#4062)
* 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> |
||
|
|
47833bfc80 |
Partially Fixes #2975 - Upgrades UICatalog to Menuv2 (#4011)
|
||
|
|
acb5979e6c |
Cleans up/Refactors View.Subviews (#3962)
* 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 |
||
|
|
b0f32811eb |
Fixes #3930 - Splits tests to Tests/UnitTests, Tests/IntegrationTests, Tests/StressTests (#3954)
* 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> |
||
|
|
98f70b2632 |
Adds ViewportSettings.Transparent (#3886)
|
||
|
|
79cd4e92b7 |
Adds Logging level control to UICatalog (#3938)
* 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 |
||
|
|
df9549e0a2 |
Tons of V2 API doc fixes (#3932)
* Tons of API doc updates * tweaked scenario * try to fix unit test crash in ubuntu action * try to fix unit test crash in ubuntu action2 |
||
|
|
95f21c383e | LineCanvas code cleanup and API docs | ||
|
|
552f9ed0a8 | Fix some bug, clean code and more unit tests. | ||
|
|
6498610de9 |
Fixes #3678. ContextMenu accesses disposed MenuBar. (#3681)
* 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> |
||
|
|
2939108bfe | Added Toplevel to spelling dict | ||
|
|
2e0a9a7c68 | Fixed nullable warnings | ||
|
|
3f29a96b33 | Split out the todo list items and unify their definitions | ||
|
|
22fe127522 | Add a settings layer to move and separate todo list settings to. | ||
|
|
f13786f512 | New regex for CONCURRENCY | ||
|
|
9ef8545127 | New regex for INTENT | ||
|
|
3c72c5a646 | New regex for TODO | ||
|
|
e7524da6b3 | New regex for QUESTION | ||
|
|
e502d84636 | New regex for NOTE | ||
|
|
3e28ed232a | New regex for SECURITY | ||
|
|
0a26d51bea | New regex for PERFORMANCE | ||
|
|
a8e54a6c72 | New regex for SUGGESTION | ||
|
|
36813eb64e | New regex for BUG |