Commit Graph

8194 Commits

Author SHA1 Message Date
Dominik Szymański
168d233428 Fixes #4272 - Update ListView's AllowsMultipleSelection to adhere to docs (#4273)
* #4272 - Update ListView's AllowsMultipleSelection to adhere to docs

* Add and update unit tests for ListView's marking
2025-10-07 09:22:18 -06:00
Copilot
e352dde696 Fixes #4151, #4152. Remove LineView class and replace all usages with Line (#4268)
* Initial plan

* Remove LineView and replace all usages with Line

- Deleted LineViewExample.cs scenario
- Deleted LineViewTests.cs test file
- Replaced LineView with Line in all examples (CollectionNavigatorTester, FileDialogExamples, LineExample, Wizard)
- Replaced LineView with Line in all tests (ViewTests, TileViewTests)
- Changed TileViewLineView to inherit from Line instead of LineView
- Removed LineView.cs file
- Removed LineView category from TileViewNesting scenario

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

* Remove LineView references from documentation

- Updated Line.cs XML documentation to remove comparison with LineView
- Removed LineView section from views.md documentation

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

* Fixes Wizard (#4269)

* fixed Wizard

* Made Line use GetAttributeForRole

---------

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>
2025-10-03 13:20:36 -07:00
Copilot
fc9c40c2a0 Fixes #4150 - Finish implementing Line View (#4260)
* Initial plan

* Add comprehensive analysis of Line implementation status

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

* Complete Line implementation with documentation, example, and tests

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

* Add PR summary documenting Line implementation completion

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

* Add comprehensive completion report for Issue 4150

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

* Fix Line rendering: use SuperView's LineCanvas instead of own

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

* Redesign Line to use Border instead of manual LineCanvas

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

* Add Line.Style property to avoid BorderStyle conflict

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

* Add SetWidth/SetHeight methods to preserve dimensions on Orientation change

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

* Implement CWP events for Width/Height properties; update Line to use events

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

* WIP: Updating Line.
Cleaned up Layout tests.

* Made Height/Width non-nullable

* Add doWork stage to CWPPropertyHelper to execute between Changing and Changed events

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

* Move ViewLayoutEventTests to parallelizable tests without AutoInitShutdown

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

* Replace tracking fields with Length property for thread-safe Line implementation

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

* Fix orientation handling to preserve user-set dimensions in object initializers

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

* Simplify orientation handling with dimension swapping - all tests passing

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

* Add Length backing field and fix object initializer dimension handling

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

* Use CWP OnChanging events to manage dimensions instead of OnChanged

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

* Move LineTests to parallelizable; simplify tests with GetAnchor; fix Length property

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

* Code cleanup.

* Code cleanup.

* Update Terminal.Gui/ViewBase/View.Layout.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Terminal.Gui/ViewBase/View.Layout.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Terminal.Gui/ViewBase/View.Layout.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Terminal.Gui/ViewBase/View.Layout.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fixed nullable warning in test

* Removed PR files and updated copilot guidance

* Reverted .gitignore change

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-03 12:26:45 -07:00
Tig
1822216130 Renamed copilot instructions so it actually works 2025-10-03 12:16:14 -07:00
Tig
f8223b7c93 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-10-03 12:15:15 -07:00
Copilot
cb381bd74b Add copilot-instructions.md file for GitHub Copilot integration (#4265)
* Initial plan

* Add copilot-instructions.md file

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

* Revise GitHub Copilot instructions for clarity

Updated instructions for GitHub Copilot in the Terminal.Gui project, including clarifications on coding conventions, API design guidelines, and additional guidelines for contributors.

* Update copilot-instructions.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-03 10:15:31 -07:00
Tig
c262a4b065 Merge branch 'v2_develop' into v2_release 2025-10-02 09:01:26 -06:00
Tig
4de8eda494 Merge branch 'v2_release' of tig:gui-cs/Terminal.Gui into v2_release 2025-10-02 09:00:40 -06:00
Tig
d2c8693abe Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-10-02 09:00:15 -06:00
BDisp
00975d025b Fixes #4246. v2net doesn't work with Force16Colors (#4247)
* Fixes #4246. v2net doesn't work with Force16Colors

* Fixes #4248. v2net sometimes output mouse inputs after exit the app

* Fix unit test

* Fix cursor visibility and cursor styles

* Fix Ctrl being ignored in the range \u0001-\u001a

* Helper method to map char to control keys

* Add unit test for the MapChar method

* Add more sequences related with macOS

* Fix issue on Windows where sending AltGr+some key fail assertion

* Only Ctrl+I is considered as Tab key and not with more

* Avoid sometimes error when running gnome-terminal

* Captures Ctrl+Shift+Alt+D7

* Exclude Oem1 from assertion

* Captures Ctrl+D4, Ctrl+D5, Ctrl+D6 and Ctrl+D7

* Definitively fixes mouse sequence escape from outputting on exit

* Add unit test for Ctrl+Shift+Alt+7

* Fix regex pattern

* Replace with hexadecimal values

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-10-02 08:59:59 -06:00
BDisp
9d34e2792c Fixes #4250. Add a v2unix driver (#4251)
* Implement Unix driver

* Add more sequences related with macOS

* Helper method to map char to control keys

* Add DriverName property

* Fix error on Unix unit tests

* Fix Non-nullable property 'DriverName' must contain a non-null value when exiting constructor.

* Fix Ctrl being ignored in the range \u0001-\u001a

* Add unit test for the MapChar method

* Fix cursor visibility and cursor styles

* Avoid sometimes error when running gnome-terminal

* Captures Ctrl+Shift+Alt+D7

* Captures Ctrl+D4, Ctrl+D5, Ctrl+D6 and Ctrl+D7

* Add unit test for Ctrl+Shift+Alt+7

* Fix issue on Windows where sending AltGr+some key fail assertion

* Exclude Oem1 from assertion

* Fix regex pattern

* Remove driverName from the constructor

* Revert "Remove driverName from the constructor"

This reverts commit 004e9f9588.

* Remove driverName from the constructor

* Add generic CreateSubcomponents method avoiding redundancy

* Add v2unix profiles

* Replace with hexadecimal values

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-10-02 08:51:05 -06:00
Tig
39755a044a Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-10-02 05:28:56 -06:00
Tig
4c6145cee9 Fixes #4233 - CharMap rendering (#4255)
* Fixed almost all issues

* code comments

* fixed copilot suggestion

* Add Unicode filtering and improve context menu handling

Enabled nullable reference types for better null safety. Added a
Unicode category filter to `CharacterMap` via the new
`ShowUnicodeCategory` property and `OptionSelector`. Updated
rendering logic to dynamically manage visible rows based on the
filter, improving performance and usability.

Refactored menu items to include the Unicode category selector.
Enhanced `TextView` context menu handling to support mouse-based
positioning. Performed miscellaneous code cleanup and added
comments for improved readability and maintainability.

* Fix Unicode rendering and simplify CombiningMarks

Updated `RuneExtensions.GetColumns` to handle specific Unicode glyphs (I Ching symbols) rendered as double-width in Windows Terminal, despite being single-width per Unicode. Added a workaround to return `2` for these glyphs and fallback to `UnicodeCalculator.GetWidth` for others.

Simplified `CombiningMarks` by removing examples for Unicode characters `\u0600` and `\u0301`, streamlining the scenario.

Referenced PR #4255 for context on the workaround.

* Update RuneTests with new Unicode test cases and fixes

Added new test cases for Unicode characters U+d7b0 (ힰ) and
U+f61e () with expected parameters. Updated the test case
for U+4dc0 (䷀) to adjust the second parameter from 1 to 2
and added references to the Microsoft Terminal Unicode
width overrides file and GitHub issue #19389. Existing test
cases for other Unicode characters remain unchanged.

* Update Terminal.Gui/Views/CharMap/CharMap.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update comments in GetColumns method for clarity

Updated comments in the `GetColumns` method of the `RuneExtensions` class to replace "HACK" with "TODO" and reference issue #4259 instead of pull request #4255. This change clarifies that the code is a temporary measure and should be removed once the issue is resolved. No functional changes were made to the code logic.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-27 13:26:44 -06:00
Tig
3fb1c413b1 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-09-13 09:33:15 -06:00
BDisp
b3aa9c5717 Fixes #4223. SendKeys scenario is broken and does not support surrogate pairs (#4224)
* Fixes #4223. SendKeys scenario is broken and does not support surrogate pairs

* Fix v2 application tests

* Fixes v2 _input being null before initialization

* Add a limit of iterations to avoid loop forever

* Simplify unit tests failure fix

* Fixes #3947 Adds Fake driver and fixes fluent tests (iteration-zero) (#4225)

* Consider width2 chars that are not IsBmp

* Apply same fix in WindowsDriver

* Explicitly use type of local variable

* Revert changes to WindowsDriver

* Assume we are running in a terminal that supports true color by default unless user explicitly forces 16

* Switch to SetAttribute and WriteConsole instead of WriteConsoleOutput for 16 color mode

* Fix some cursor issues (WIP)

* Remove concept of 'dirty rows' from v2 as its never actually used

* Remove damageRegion as it does nothing

* Make string builder to console writing simpler

* Radically simplify Write method

* Simplify conditional logic

* Simplify restoring cursor position

* Reference local variable for console buffer

* Reduce calls to ConsoleWrite by accumulating till attribute changes

* When resizing v2 16 color mode on windows, recreate the back buffer to match its size

* Fixes for VTS enabled

* Fix _lastSize never being assigned

* Fixes VTS for Force16Colors

* Fixes force16Colors in VTS

* Fixes escape sequences always echoing in non-VTS

* Force Force16Colors in non-VTS. It have a bug in adding a newline in the last line

* WIP Add base class for NetOutput

* Abstract away how we change attribute

* WIP - Make WindowsOutput use base class

* WIP working to fix set cursor position

* Remove commented out code

* Fixes legacy output mode

* Fixes size with no alt buffer supported on VTS and size restore after maximized.

* Fix set cursor which also fixes the broken surrogate pairs

* Add force parameter

* Fixes an issue that only happens with Windows Terminal when paste surrogate pairs by press Ctrl+V

* In Windows escape sequences must be sent during the lifetime of the console which is created in input handle

* Ensure flush the input buffer before reset the console

* Flush input buffer before reset console in v2win

* Fixes issue in v2net not being refreshing the menu bar at start

* Only force layout and draw on size changed.

* Fix v2net issue not draw first line by forcing set cursor position

* Set _lastCursorPosition nullable and remove bool force from set cursor position

* Remove force parameter

* Add v2 version of fake driver attribute

* Make direct replacement and wire up window resizing events

* Update casts to use V2 fake driver instead

* Adjust interfaces to expose less internals

* Fix not raising iteration event in v2

* WIP investigate what it takes to do resize and redraw using TextAlignment_Centered as example

* Sketch adding component factory

* Create relevant fake component factories

* Add window size monitor into factory

* Fake size monitor injecting

* Add helper for faking console resize in AutoInitShutdown tests

* Fix size setting in FakeDriverV2

* Switch to new method

* Fix IsLegacy becoming false when using blank constructor

* Fix for Ready not being raised when showing same top twice also fixes garbage collection issue if running millions of top levels

* Fix tests

* Remove auto init

* Restore conditional compilation stuff

* Restore 'if running unit tests' logic

* Check only for the output being specific classes for the suppression

* Fix ShadowView blowing up with index out of bounds error

* Fix resize in fluent tests

* Fix for people using Iteration call directly

* Fix more calls to iteration to use
        AutoInitShutdownAttribute.RunIteration ();

* Add comment

* Remove assumption that Run with prior view not disposed should throw

* Fix timings in Dialog_Opened_From_Another_Dialog

* Fix Zero_Buttons_Works

* Standardize and fix Button_IsDefault_True_Return_His_Index_On_Accepting

* Fix iteration counts on MessageBoxTests

* Fix WizartTests and DrawTests_Ruler

* Implement SendKeys into ConsoleDriverFacade

* Fix SendKeys in console driver facade such that FileDialogTests works
Fix when Clip is null in popover

* Add missing dispose call to test

* Fix support for Esc in facade SendKeys

* Fix AutocompleteTests

* Fix various tests

* Replace LayoutAndDraw with run iteration

* Fix draw issues

* fix draw order

* Fix run iteration calls

* Fix unit tests

* Fix SendKeys in facade.

* Manipulate upper and lower cases.

* Add IsValidInput method to the interface.

* Fix SendKeys scenario

* Fixes surrogate pairs in the label

* Make tests more sensible - they are testing draw functionality.  Callbacks do not need to happen in Iteration method

* Fix tests and harden cleanup in AutoInitShutdownAttribute v2 lifecycle dispose

* Delete extra create input call

* Fix mocks and order of exceptions thrown in Run when things are not initialized

* Revert use of `MapConsoleKeyInfoToKeyCode`

* Ignore casing as it is not what test is really about

* Clear application top and top levels before each auto init shutdown test

* Fix for unstable tests

* Restore actually working SendKeys code

* option to pass logger in fluent ctor

* restore ToArray

* Fix SendKeys method and add extension to unit test

* Leverage the EscSeqUtils.MapConsoleKeyInfo method to avoid duplicate code

* Remove unnecessary hack

* Using only KeyCode for rKeys

* Recover modifier keys in surrogate pairs

* Reformat

* Remove iteration limit for benchmarking in v2

* remove iteration delay to identify bugs

* Remove nudge to unique key and make Then run on UI thread

* fix fluid assertions

* Ensure UI operations all happen on UI thread

* Add explicit error for WaitIteration during an invoke

* Remove timeout added for debug

* Catch failing asserts better

* Fix screenshot

* Fix null ref

* Fix race condition in processing input

* Test fixing

* Standardize asserts

* Remove calls to layout and draw, remove pointless lock and enable reading Cancelled from Dialog even if it is disposed

* fix bad merge

* Make logs access threadsafe

* add extra wait to remove race between iteration end and assert

* Code cleanup

* Remove test for crash on access Cancelled after dispose as this is no longer a restriction

* Change resize console to run on UI thread - fixing race condition with redrawing

* Restore original frame rate after test

* Restore nudge to unique key

* Code Cleanup

* Fix for cascading failures when an assert fails in a specific test

* fix for bad merge

* Address PR feedback

* Move classes to seperate files and add xmldoc

* xml doc warnings

* More xml comments docs

* Fix spelling

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>

* Fixes #4231. NativeAot project throws when running the published executable (#4232)

* Fixes #4231. NativeAot project throws when running the published executable

* Code cleanup

---------

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

* Fixes #4236. CursesDriver erase the previous text under the cursor when moving if Force16Colors is true (#4237)

* Fixes #4236. CursesDriver erase the previous text under the cursor when moving if Force16Colors is true

* Still trying to fix fluent unit tests

* Fix nullable issue

---------

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

* Need to use KeyCode to return the desired effect with control keys

* Revert v2 drivers changes

* Fix nullable warnings

* Fixes #4025. Application.Driver.SendKeys should be retired

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: Thomas Nind <31306100+tznind@users.noreply.github.com>
2025-09-12 20:21:51 -06:00
Tig
18b602e980 Fixes #4243 - ConsoleDriverFacade.CreateClipboard now honors FakeDriver.FakeBehaviors.UseFakeClipboard (#4244)
* updatd ConsoleDriverFacade.CreateClipboard to honor FakeDriver.FakeBehaviors.UseFakeClipboard

* Code cleanup of fake driver v2
2025-09-12 13:32:31 -06:00
BDisp
e869f842e3 Fixes #4241. v2net driver isn't suspending on Unix platforms (#4242)
Co-authored-by: Tig <tig@users.noreply.github.com>
2025-09-11 13:49:25 -06:00
BDisp
ad8ebc9890 Fixes #4200. ExtendedCharInfo needs be enhanced to properly deal with all codepoints (#4202)
* Fixes #4196. Application.Begin doesn't refresh the screen at start

* Fixes #4198. Application.Invoke isn't wakeup the driver if idle

* Reformatting to run CI again

* Revert "Reformatting to run CI again"

This reverts commit ef639c1e64.

* Trying fix an issue where sometimes subview variable is null running unit tests

* Replace ExtendedCharInfo.Char with char array

* Replace IsWindowsTerminal with IsVirtualTerminal

* Add a lastSize parameter to process resize automatically

* Handling surrogate pairs in input

* Implement SetConsoleTextAttribute

* Prevent select true color is not supported

* Fix null exception

* Revert GetWindowSize and add SetWindowSize

* Fix unit tests

* Revert all v2 changes except the one related with the ExtendedCharInfo

* Revert newlines and FakeOutput

* Prevents null reference

* Add gnome-terminal to launch settings

* Fixes issue on restore window size after maximize causing width shrinking

* Add ; exec bash to stay in terminal

* Fixes issue on restore window size after maximize causing width shrinking

* Tidying up input and output console modes

* Fixes uninitialized screen buffer.

* Revert "Fixes issue on restore window size after maximize causing width shrinking"

This reverts commit e5edad79f6.

* Reset console after sending escape sequences

* Remove unnecessary code only for buggy VSDebugConsole

* Fix more annoying exceptions

* Ensure flush the input buffer before reset the console

* Remove unnecessary ENABLE_VIRTUAL_TERMINAL_INPUT

* Remove unnecessary error handles

* Fix CI warnings

* Fix more CI warnings

* Fix more CI warnings

* Fixes #2796. CursesDriver doesn't render wide codepoints correctly

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-09-11 13:37:03 -06:00
Tig
6b7855e6b8 Merge pull request #4240 from tig/v2_4239-Charmap 2025-09-10 19:12:14 -07:00
Tig
2db6bc18e0 Merge branch 'v2_develop' into v2_4239-Charmap 2025-09-10 09:47:17 -07:00
BDisp
02d24bba69 Fixes #4236. CursesDriver erase the previous text under the cursor when moving if Force16Colors is true (#4237)
* Fixes #4236. CursesDriver erase the previous text under the cursor when moving if Force16Colors is true

* Still trying to fix fluent unit tests

* Fix nullable issue

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-09-10 10:46:59 -06:00
BDisp
da9286d3f4 Fixes #4231. NativeAot project throws when running the published executable (#4232)
* Fixes #4231. NativeAot project throws when running the published executable

* Code cleanup

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-09-10 10:44:08 -06:00
Tig
2c5c6038f9 Fixed bug.
Fixed warnings.
2025-09-10 10:41:35 -06:00
Tig
885da6667b Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-09-10 10:05:59 -06:00
Tig
316588a825 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-09-10 09:02:05 -07:00
Thomas Nind
51dda7e69f Fixes #3947 Adds Fake driver and fixes fluent tests (iteration-zero) (#4225)
* Consider width2 chars that are not IsBmp

* Apply same fix in WindowsDriver

* Explicitly use type of local variable

* Revert changes to WindowsDriver

* Assume we are running in a terminal that supports true color by default unless user explicitly forces 16

* Switch to SetAttribute and WriteConsole instead of WriteConsoleOutput for 16 color mode

* Fix some cursor issues (WIP)

* Remove concept of 'dirty rows' from v2 as its never actually used

* Remove damageRegion as it does nothing

* Make string builder to console writing simpler

* Radically simplify Write method

* Simplify conditional logic

* Simplify restoring cursor position

* Reference local variable for console buffer

* Reduce calls to ConsoleWrite by accumulating till attribute changes

* When resizing v2 16 color mode on windows, recreate the back buffer to match its size

* Fixes for VTS enabled

* Fix _lastSize never being assigned

* Fixes VTS for Force16Colors

* Fixes force16Colors in VTS

* Fixes escape sequences always echoing in non-VTS

* Force Force16Colors in non-VTS. It have a bug in adding a newline in the last line

* WIP Add base class for NetOutput

* Abstract away how we change attribute

* WIP - Make WindowsOutput use base class

* WIP working to fix set cursor position

* Remove commented out code

* Fixes legacy output mode

* Fixes size with no alt buffer supported on VTS and size restore after maximized.

* Fix set cursor which also fixes the broken surrogate pairs

* Add force parameter

* Fixes an issue that only happens with Windows Terminal when paste surrogate pairs by press Ctrl+V

* In Windows escape sequences must be sent during the lifetime of the console which is created in input handle

* Ensure flush the input buffer before reset the console

* Flush input buffer before reset console in v2win

* Fixes issue in v2net not being refreshing the menu bar at start

* Only force layout and draw on size changed.

* Fix v2net issue not draw first line by forcing set cursor position

* Set _lastCursorPosition nullable and remove bool force from set cursor position

* Remove force parameter

* Add v2 version of fake driver attribute

* Make direct replacement and wire up window resizing events

* Update casts to use V2 fake driver instead

* Adjust interfaces to expose less internals

* Fix not raising iteration event in v2

* WIP investigate what it takes to do resize and redraw using TextAlignment_Centered as example

* Sketch adding component factory

* Create relevant fake component factories

* Add window size monitor into factory

* Fake size monitor injecting

* Add helper for faking console resize in AutoInitShutdown tests

* Fix size setting in FakeDriverV2

* Switch to new method

* Fix IsLegacy becoming false when using blank constructor

* Fix for Ready not being raised when showing same top twice also fixes garbage collection issue if running millions of top levels

* Fix tests

* Remove auto init

* Restore conditional compilation stuff

* Restore 'if running unit tests' logic

* Check only for the output being specific classes for the suppression

* Fix ShadowView blowing up with index out of bounds error

* Fix resize in fluent tests

* Fix for people using Iteration call directly

* Fix more calls to iteration to use
        AutoInitShutdownAttribute.RunIteration ();

* Add comment

* Remove assumption that Run with prior view not disposed should throw

* Fix timings in Dialog_Opened_From_Another_Dialog

* Fix Zero_Buttons_Works

* Standardize and fix Button_IsDefault_True_Return_His_Index_On_Accepting

* Fix iteration counts on MessageBoxTests

* Fix WizartTests and DrawTests_Ruler

* Implement SendKeys into ConsoleDriverFacade

* Fix SendKeys in console driver facade such that FileDialogTests works
Fix when Clip is null in popover

* Add missing dispose call to test

* Fix support for Esc in facade SendKeys

* Fix AutocompleteTests

* Fix various tests

* Replace LayoutAndDraw with run iteration

* Fix draw issues

* fix draw order

* Fix run iteration calls

* Fix unit tests

* Fix SendKeys in facade.

* Manipulate upper and lower cases.

* Add IsValidInput method to the interface.

* Fix SendKeys scenario

* Fixes surrogate pairs in the label

* Make tests more sensible - they are testing draw functionality.  Callbacks do not need to happen in Iteration method

* Fix tests and harden cleanup in AutoInitShutdownAttribute v2 lifecycle dispose

* Delete extra create input call

* Fix mocks and order of exceptions thrown in Run when things are not initialized

* Revert use of `MapConsoleKeyInfoToKeyCode`

* Ignore casing as it is not what test is really about

* Clear application top and top levels before each auto init shutdown test

* Fix for unstable tests

* Restore actually working SendKeys code

* option to pass logger in fluent ctor

* restore ToArray

* Fix SendKeys method and add extension to unit test

* Leverage the EscSeqUtils.MapConsoleKeyInfo method to avoid duplicate code

* Remove unnecessary hack

* Using only KeyCode for rKeys

* Recover modifier keys in surrogate pairs

* Reformat

* Remove iteration limit for benchmarking in v2

* remove iteration delay to identify bugs

* Remove nudge to unique key and make Then run on UI thread

* fix fluid assertions

* Ensure UI operations all happen on UI thread

* Add explicit error for WaitIteration during an invoke

* Remove timeout added for debug

* Catch failing asserts better

* Fix screenshot

* Fix null ref

* Fix race condition in processing input

* Test fixing

* Standardize asserts

* Remove calls to layout and draw, remove pointless lock and enable reading Cancelled from Dialog even if it is disposed

* fix bad merge

* Make logs access threadsafe

* add extra wait to remove race between iteration end and assert

* Code cleanup

* Remove test for crash on access Cancelled after dispose as this is no longer a restriction

* Change resize console to run on UI thread - fixing race condition with redrawing

* Restore original frame rate after test

* Restore nudge to unique key

* Code Cleanup

* Fix for cascading failures when an assert fails in a specific test

* fix for bad merge

* Address PR feedback

* Move classes to seperate files and add xmldoc

* xml doc warnings

* More xml comments docs

* Fix spelling

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
2025-09-10 10:01:57 -06:00
Tig
6ca870d14b Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-09-02 09:52:11 -06:00
Tig
9f7755dc98 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-09-01 10:42:22 -07:00
Tig
2ca3006746 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-09-01 10:40:21 -06:00
BDisp
00aaefb962 Fixes #3951. Adds View dependency to DimFunc and PosFunc (#4210)
* Fixes #4208. MainLoopSyncContext doesn't work with the v2 drivers

* Fixes #3951. Add DimFuncWithView with a View dependency

* Revert to iteration which will handle the necessary processes

* Revert "Revert to iteration which will handle the necessary processes"

This reverts commit 50015ac6da.

* Layout and draw before position cursor

* Add optional View parameter and property to the DimFunc and PosFunc

* Trying fix unit test error

* Revert layout changes

* Fixes #4216. Legacy drivers aren't refreshing the screen correctly on view drag

* Add assertion proving NeedsLayout is always false before call OnSubViewsLaidOut

* Fix unit test error

* Increasing time to abort

* Revert "Increasing time to abort"

This reverts commit d7306e72f3.

* Trying fix integration tests

* Still trying fix integrations unit tests

* Revert comment

* Layout is performed during the iteration

* Using Dim.Func with status bar view

* Still trying fix integrations tests by locking _subviews

* Still trying fix integrations tests by locking _subviews

* Add internal SnapshotSubviews method

* Remove lock from SnapshotSubviews method

* Using SnapshotSubviews method in the DrawSubViews method

* Remove lock from SnapshotSubviews method

* Using SnapshotSubviews method in the DrawSubViews method

* Using SnapshotSubviews

* Prevent new app if the previous wasn't yet finished

* Replace SnapshotSubviews method with ViewCollectionHelpers class

* Lock entire GuiTestContext constructor

* Using Snapshot in the ordered field

* Fixes #4221 Extra modifiers f1 to f4 in v2net (#4220)

* Assume we are running in a terminal that supports true color by default unless user explicitly forces 16

* Add support for extra modifiers for F1 to F4 keys

* Revert "Assume we are running in a terminal that supports true color by default unless user explicitly forces 16"

This reverts commit 4cc2530de0.

* Cleanup

* Update comments

* Code cleanup

---------

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

* Move ViewCollectionHelpers class to a separate file

* Remove Border.Layout call in the DoDrawAdornmentsSubViews method.

* Remove adornments layout call within the draw

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
Co-authored-by: Thomas Nind <31306100+tznind@users.noreply.github.com>
2025-09-01 10:40:10 -06:00
Thomas Nind
7ca765cef1 Fixes #4221 Extra modifiers f1 to f4 in v2net (#4220)
* Assume we are running in a terminal that supports true color by default unless user explicitly forces 16

* Add support for extra modifiers for F1 to F4 keys

* Revert "Assume we are running in a terminal that supports true color by default unless user explicitly forces 16"

This reverts commit 4cc2530de0.

* Cleanup

* Update comments

* Code cleanup

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-08-31 09:57:30 -06:00
Tig
1fb983636c Merge branch 'gui-cs:v2_develop' into v2_develop 2025-08-31 09:53:05 -06:00
Daniel Marbach
5e7bfb8908 Root SchemeName can only be set when the popover is not null (#4226)
* Root schema can only be set when the popover is not null

* Fix event selection

* Remove unnecessary null forgiving

---------

Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com>
Co-authored-by: Tig <tig@users.noreply.github.com>
2025-08-31 09:52:33 -06:00
BDisp
1a0f5a88b7 Fixes #4228. Init crashes if there are assemblies that have load issues (#4230) 2025-08-31 09:46:11 -06:00
Thomas Nind
ab49fb8b43 Fixes 4191 - Rewrite WindowsOutput (#4193)
* Consider width2 chars that are not IsBmp

* Apply same fix in WindowsDriver

* Explicitly use type of local variable

* Revert changes to WindowsDriver

* Assume we are running in a terminal that supports true color by default unless user explicitly forces 16

* Switch to SetAttribute and WriteConsole instead of WriteConsoleOutput for 16 color mode

* Fix some cursor issues (WIP)

* Remove concept of 'dirty rows' from v2 as its never actually used

* Remove damageRegion as it does nothing

* Make string builder to console writing simpler

* Radically simplify Write method

* Simplify conditional logic

* Simplify restoring cursor position

* Reference local variable for console buffer

* Reduce calls to ConsoleWrite by accumulating till attribute changes

* When resizing v2 16 color mode on windows, recreate the back buffer to match its size

* Fixes for VTS enabled

* Fix _lastSize never being assigned

* Fixes VTS for Force16Colors

* Fixes force16Colors in VTS

* Fixes escape sequences always echoing in non-VTS

* Force Force16Colors in non-VTS. It have a bug in adding a newline in the last line

* WIP Add base class for NetOutput

* Abstract away how we change attribute

* WIP - Make WindowsOutput use base class

* WIP working to fix set cursor position

* Remove commented out code

* Fixes legacy output mode

* Fixes size with no alt buffer supported on VTS and size restore after maximized.

* Fix set cursor which also fixes the broken surrogate pairs

* Add force parameter

* Fixes an issue that only happens with Windows Terminal when paste surrogate pairs by press Ctrl+V

* In Windows escape sequences must be sent during the lifetime of the console which is created in input handle

* Ensure flush the input buffer before reset the console

* Flush input buffer before reset console in v2win

* Fixes issue in v2net not being refreshing the menu bar at start

* Only force layout and draw on size changed.

* Fix v2net issue not draw first line by forcing set cursor position

* Set _lastCursorPosition nullable and remove bool force from set cursor position

* Remove force parameter

* Cleanup code

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
2025-08-31 09:41:09 -06:00
Tig
3a4518f9e6 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-08-31 09:00:07 -06:00
Tig
b0705405a6 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-08-31 09:00:01 -06:00
BDisp
a3399776b7 Fixes nuget packages with vulnerabilities (#4218)
* Fixes nuget packages with vulnerabilities

* Using netstandard2.1

* Revert "Using netstandard2.1"

This reverts commit b19317f8c1.

* Replacing to 3.11.0 and 4.13.0 versions

* Using 4.12.0 version

* Revert "Using 4.12.0 version"

This reverts commit bb4f9212c4.

* Change to 4.12.0 version

* Remove unused nuget package
2025-08-01 07:37:01 -06:00
BDisp
48d4de2e63 Fixes #4214. Annoying sporadic System.NullReferenceException in WindowsConsole (#4215) 2025-07-28 06:33:55 -06:00
BDisp
847123aa00 Fixes #4211. Annoying sporadic System.NullReferenceException in NetEvents (#4213) 2025-07-26 18:38:44 -06:00
Tig
f30d5be27d Merge branch 'gui-cs:v2_develop' into v2_develop 2025-07-25 08:04:07 -06:00
BDisp
807f1fdcc8 Fixes #4204. v2win and v2net aren't refreshing the Character Map correctly (#4205)
* Fixes #4204. v2win and v2net aren't refreshing the Character Map correctly

* Reformat to run CI again

* Revert "Reformat to run CI again"

This reverts commit 3efad83f52.

* Revert "Fixes #4204. v2win and v2net aren't refreshing the Character Map correctly"

This reverts commit 6ec4adcc45.

* Apply @tig suggested changes

* Fixes #4208. MainLoopSyncContext doesn't work with the v2 drivers

* Trying fix unit test error

* Revert "Trying fix unit test error"

This reverts commit 3aaefd6053.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-07-25 05:54:14 -06:00
BDisp
2025a81511 Fixes #4208. MainLoopSyncContext doesn't work with the v2 drivers (#4209) 2025-07-24 17:06:46 -06:00
Tig
e3049bcb37 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-07-24 07:14:43 -06:00
BDisp
add2877e09 Fixes #4206. There is no need to use a Task.Run to force Invoke in the MainThreadId (#4207) 2025-07-24 06:26:51 -06:00
BDisp
3b13d5a83c Fixes #4196. Application.Begin doesn't refresh the screen at start (#4197)
* Fixes #4196. Application.Begin doesn't refresh the screen at start

* Reformatting to run CI again

* Revert "Reformatting to run CI again"

This reverts commit ef639c1e64.

* Trying fix an issue where sometimes subview variable is null running unit tests

* Add comment and decrease the delay time
2025-07-22 13:58:10 -06:00
BDisp
2ec08d5939 Fixes #4198. Application.Invoke isn't wakeup the driver if idle (#4199) 2025-07-22 13:57:38 -06:00
Tig
83c63a24a6 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-07-10 12:02:49 -06:00
Thomas Nind
ec827e901e Fixes #4172 Timeout revamp and remove continuous mouse (#4173)
* Remove continous press code from Application

* WIP prototype code to handle continuous press as subcomponent of View

* Prototype with Button

* Implement CWP

* Move to seperate classes and prevent double entry to Start

* Fix repeat clicking when moving mouse by removing phantom click code (old implementation of WantContinuousButtonPressed)

* Remove initial tick because it results in double activation e.g. button firing twice immediately as mouse is pressed down.

* Refactor DatePicker lamdas

* WIP investigate subcomponents instead of statics

* Add IMouseGrabHandler to IApplication

* Make mouse grabbing non static activity

* Make MouseHeldDown suppress when null fields e.g. app not initialized in tests

* Update test and remove dependency on Application

* Fix other mouse click and hold tests

* Code cleanup

* Update class diagram

* Fix bad xml doc references

* Fix timed events not getting passed through in v2 applications

* Make timed events nullable for tests that dont create an Application

* Remove strange blocking test

* WIP remove all idles and replace with zero timeouts

* Fix build of tests

* Fix unit tests

* Add wakeup call back in

* Comment out incredibly complicated test and fix others

* Fix test

* test fix

* Make Post execute immediately if already on UI thread

* Re enable test and simplify Invoke to just execute if in UI thread (up front)

* Remove xml doc references to idles

* Remove more references to idles

* Make Screen initialization threadsafe

* Add more exciting timeouts

* WIP add tests

* fix log

* fix test

* make continuous key press use smoth acceleration

* Rename _lock to _lockScreen

* Remove section on idles, they are not a thing anymore - and they kinda never were.

* Add nullable enable

* Add xml comment

* Fix namings and cleanup code

* xmldoc fix

* Rename LockAndRunTimers to just RunTimers

* Rename AddTimeout and RemoveTimeout (and event) to just Add/Remove

* Update description of MainLoop

* Commented out Run_T_Call_Init_ForceDriver_Should_Pick_Correct_Driver

* Again? Commented out Run_T_Call_Init_ForceDriver_Should_Pick_Correct_Driver

* Revert Commented out Run_T_Call_Init_ForceDriver_Should_Pick_Correct_Driver

* When mouse is released from MouseHeldDown reset host MouseState

* Fix namespaces in class diagram

* Apply @BDisp suggested fix

* Fix class diagrams

* Add lock

* Make TimeSpan.Zero definetly run

* Fix duplicate entry in package props

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-07-10 11:59:27 -06:00
Tig
62fd462141 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-07-07 11:06:11 -06:00