Commit Graph

8070 Commits

Author SHA1 Message Date
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
Thomas Nind
23cacaee93 Fix integration tests failing on command line (#4185)
Co-authored-by: Tig <tig@users.noreply.github.com>
2025-07-07 11:05:53 -06:00
Tig
87fe518ea9 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-07-07 09:34:11 -06:00
Thomas Nind
3a645191db Fixes #4170 - Added analyzer that flags when user does not have Handled=true (#4182)
* Added analyzer

* WIP - Trying to create tests, failing with bad dependencies

* Working test woo

* Tidy up

* Tidy up

* Fix integration tests failing on command line

* Use 4.11 compiler

* Fix expecting 'e' as param name

* Make analyzer come as part of Terminal.Gui

* Add docs

* Fix warnings
2025-07-07 09:14:43 -06:00
Tig
639307248a Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-06-29 19:06:17 -06:00
Nemo Xiong
3d53c30ee1 readme: update outdated doc links (#4181) 2025-06-28 07:47:00 -06:00
Daniel Marbach
43142dedc3 Cleanup Dependencies slighty (#4178)
* Source link should be private

* Remove unnecessary System.Text.Json reference

* Use logging abstractions

* Use fixed logging version

* Remove unnecessary analysis references

---------

Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com>
2025-06-27 10:11:59 -06:00
BDisp
497ddb3b3e Fixes #4164. FluentTests sometime causes unit tests failures locally and in CI (#4165) 2025-06-24 09:23:46 -07:00
BDisp
b50a8fd665 Fixes #4162. Keyword dynamic isn't AOT-Compatible and must be removed (#4163) 2025-06-15 10:57:55 -06:00
BDisp
6e486c718e Fixes #4160. Benchmark All launch throws System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' (#4161) 2025-06-12 19:10:28 -06:00
Tig
4cd6511c89 Updated doc links 2025-06-12 13:45:39 -06:00
Tig
258824dba6 Updated readme etc for Alpha 2025-06-12 13:33:06 -06:00
Tig
e0e87a2b40 Migrating api docs 4 2025-06-12 12:27:06 -06:00
Tig
8c7c266618 Migrating api docs 3 2025-06-12 12:23:44 -06:00
Tig
5e96525522 Migrating api docs 2 2025-06-12 12:22:11 -06:00
Tig
40d6250427 Migrating api docs 2025-06-12 12:18:25 -06:00
Tig
f4d4a25704 pre-alpha -> alpha (#4158) 2025-06-12 12:16:54 -06:00
Tig
6e5e6dbbb9 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-06-12 12:03:41 -06:00
BDisp
ad1de255b1 Fixes #4139. Application.Run<T> isn't initializing properly by setting the Application.ForceDriver property (#4142)
* Fixes #4139. Application.Run<T> isn't initializing properly by setting the Application.ForceDriver property

* Trying fix unit tests

* Only to force again CI tests because I haven't errors locally

* This should pass, unless RunningUnitTests is set to false somewhere

* Fix Unix unit tests and failures via ReSharper

* Changes suggested by @tig

* Prevent empty string

* Centralize all the entry logic in the InternalInit method

* Change GetDriverTypes to return a tuple
2025-06-12 10:48:05 -06:00
BDisp
76b7e52e12 Fixes #4143. ReactiveExample throw System.NotSupportedException: 'Index expressions are only supported with constants.' (#4144) 2025-06-11 06:44:08 -06:00
Tig
5863d383f1 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-06-09 14:37:37 -06:00
BDisp
d3f4c42785 Fixes 4132. .editorconfig has ambiguous configuration with same files (#4133)
Co-authored-by: Tig <tig@users.noreply.github.com>
2025-06-09 14:31:11 -06:00