Commit Graph

7836 Commits

Author SHA1 Message Date
Tonttu
b6a5ca1d4e Rewrite StringExtensions.ToString(IEnumerable<Rune>)
Appends rune chars to StringBuilder avoiding intermediate string allocation for each rune append.
2025-03-17 16:17:46 +01:00
Tonttu
aeffe3e36e Add benchmark category to the TextFormatter benchmarks 2025-03-17 16:17:46 +01:00
Tonttu
662e745395 Rewrite TextFormatter.ReplaceCRLFWithSpace
Almost identical to the StripCRLF implementation.
2025-03-17 16:17:46 +01:00
Tonttu
7d317ba550 StripCRLF early exit when no newline to avoid StringBuilder allocation 2025-03-17 16:17:46 +01:00
Tonttu
40d4cab510 More varied text permutations for the StripCRLF benchmark 2025-03-17 16:17:46 +01:00
Tonttu
6f63dca591 Rewrite TextFormatter.StripCRLF
Uses StringBuilder and char span indexof search to reduce intermediate allocations.

The new implementation behaves slightly different compared to old implementation. In synthetic LFCR scenario it is correctly removed while the old implementation left the CR, which seems like an off-by-one error.
2025-03-17 16:17:46 +01:00
Tonttu
c4502b0741 Add tests for TextFormatter StripCRLF and ReplaceCRLFWithSpace
Also made the helper methods internal so they can be accessed from the test project.
2025-03-17 16:17:46 +01:00
Tig
384cefcdf1 Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop v2.0.0-develop.4375 2025-03-17 15:59:37 +01:00
BDisp
56c8b20e24 Fixes #3986. ContextMenu crashing with right and left arrows 2025-03-17 07:39:19 +01:00
Tig
726770f6ee Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop v2.0.0-develop.4374 2025-03-16 20:45:34 +01:00
BDisp
76a14d456d Fixes #3986. ContextMenus now broken in v2 net and win drivers (#3987) 2025-03-16 07:51:35 +01:00
Tig
f84c528449 Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop 2025-03-13 18:18:00 +01:00
Tig
ce7fc04100 Fixes #3984 - Margin w/out shadow should not force draw (#3985)
* shortcut tests

* Generic demos

* Optimize Margin to not defer draw if there's no shadow
2025-03-13 18:16:53 +01:00
Tonttu
b09b4e78bd Fix Cell.CombiningMarks property getter rune list allocation (#3980)
* Skip rune list allocation from accessing Cell.CombiningMarks property

The getter would every time allocate a new list when the backing field was not assigned, which is most of the time.

* Fix comment about performance

I accidentally word. Is this dangerous?
2025-03-13 18:15:49 +01:00
BDisp
7aae0c2ad5 Fixes #3968. Menu appears in wrong place when opened in a subview (#3979)
* Fixes #3968. Menu appears in wrong place when opened in a subview

* Fixes #3965. Cannot exit a Window with a CanFocus true MenuBar

* Fixes #3981. Drivers crash when middle or right click on a ContextMenu item

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-13 18:15:14 +01:00
Tonttu
ef20ff68a9 Reduce string allocations in IConsoleOutput implementations (#3978)
* Change IConsoleOutput.Write(string) overload parameter to ReadOnlySpan<char>

Allows the caller more flexibility about choosing a buffer per use case.

* NetOutput: Write StringBuilder directly to the std out text stream

* Add EscSeqUtils.CSI_WriteCursorPosition

Writes cursor position sequence to text writer without string allocation.

* NetOutput: Skip cursor position escape sequence string allocation

* Replace CSI_(Enable|Disable)MouseEvents static properties with readonly fields

Changed for the sake of consistency with rest of the EscSegutils fields rather than performance. Also prevents bugs from accidentally setting the properties.

* Use EscSeqUtils.CSI_Append(Foreground|Background)ColorRGB in v2 drivers

* WindowsOutput SetCursorVisibility: Remove intermediate string builder

* WindowsOutput.WriteToConsole: Use rented array as intermediate write buffer

The large intermediate string builder remains a challenge. :)

* NetOutput: Console.Out for the sake of consistency

Also might have missed one of the Console.Out.Write(StringBuilder) calls...

* Avoid Rune.ToString() in NetOutput.Write(IOutputBuffer)

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-13 18:14:22 +01:00
Tig
0831b162a1 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-13 08:00:30 +01:00
BDisp
af633fc4fc Fixes #3976. SixLabors.ImageSharp nuget package is reporting as vulnerable (#3977)
* Fixes #3976. SixLabors.ImageSharp nuget package is reporting as vulnerable

* Upgrade all nuget packages
2025-03-09 20:08:26 -06:00
Tig
7c89a3a176 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-09 13:46:41 -06:00
Tig
3794c34d30 shortcut tests 2025-03-09 13:46:35 -06:00
Tig
e0f61abf8a Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-09 09:57:43 -06:00
Tig
f29ec60176 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-03-09 08:48:15 -06:00
BDisp
e76ec720a5 Fixes #3964. Null Reference in DoDrawBorderAndPadding (#3971)
* Fixes #3964. Null Reference in DoDrawBorderAndPadding

* Fix unit test.

* Ensures closing all opened menus that belong to another top when a new modal top is opened.

* Reformat

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-09 07:46:09 -06:00
Tig
3da22f8c70 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-08 17:12:11 -07:00
Tig
4af7d06b37 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-03-08 17:12:05 -07:00
Tig
4ad866eb26 Refactored to be thread safe. (#3973) 2025-03-08 17:11:30 -07:00
Tig
80f98878ee Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-08 15:50:09 -07:00
BDisp
f26fd285ce Fixes #3941. v2win/v2net: UICatalog full benchmark suite crashes in Dialogs scenario (#3963)
Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-08 15:49:54 -07:00
Tig
e01a98d852 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-08 15:43:04 -07:00
Tig
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
2025-03-08 15:42:17 -07:00
Tig
58610dedbc Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-08 13:48:53 -07:00
Tig
30fafb4625 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-06 14:08:03 -07:00
BDisp
85cf6619ed Fixes #3956. MessageBox doesn't return the index of IsDefault button (#3958)
* Fixes #3956. MessageBox doesn't return the index of IsDefault button

* Change to Theory test.

* Fix unit test 'Error opening terminal: unknown.'

* Remove RunningUnitTests = true because constructor already set it.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-06 14:06:51 -07:00
Thomas Nind
7162ed850c Fix v2 not raising closing events (#3961) 2025-03-06 13:14:15 -07:00
Tig
fe18c81dc9 Fixed gitversion 2025-03-06 12:48:44 -07:00
Tig
73e230b877 upgraded to gitversion 6 v2.0.0-prealpha.1 v2.0.0-prealpha.1830 2025-03-06 11:17:57 -07:00
Tig
e805023c1c upgraded to gitversion 6 2025-03-06 11:00:51 -07:00
Tig
adcc01ccee Documented GitVersion.xml v2.0.0-develop.1600 2025-03-06 10:36:42 -07:00
Tig
e0425e1d00 Reverted GitVersion.xml 2025-03-06 07:33:23 -07:00
Tig
fa1f0b3800 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-06 07:18:33 -07:00
Tig
9b76d50271 Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop 2025-03-05 23:57:50 -07:00
Tig
5984a3c564 Fixes #3941 - v2win/v2net: UICatalog crash - Fixes warnings (#3946)
* Tons of API doc updates

* Adjust timeout

* Code cleanuyp

* Disabled All_Scenarios_Benchmark

* Removed logs

* Fixed a bunch of warnings

* Fixed a bunch of warnings2

* Disabled All_Scenarios_Benchmark again...just to make sure

* Enabled All_Scenarios_Benchmark again...It is not the culprit
2025-03-05 23:57:15 -07:00
Tig
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>
2025-03-05 23:44:27 -07:00
Tig
07e850fd3d Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-03 15:50:27 -07:00
Thomas Nind
64b216b1e8 Fixes #3953 Add async support to v2 drivers (#3952)
* Add async support stuff

* Set main thread id

* Add v2 test to ensure `TaskScheduler.FromCurrentSynchronizationContext` works

* Remove uneeded async

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-02 10:57:28 -07:00
Tig
b1079e8f18 Merge branch 'v2_develop' of tig:tig/Terminal.Gui into v2_develop 2025-03-02 10:41:39 -07:00
Tig
1919abe715 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-03-02 10:41:04 -07:00
BDisp
72aaf27f91 Fixes #3930. Tests are crashing again... (#3948)
* Fixes #3930. Tests are crashing again...

* Clear the source settings on test.

* Just call CM.Reset.

* Fix one more test 'not run' because of the use of enums in parameters

* Replace void to Task
2025-03-02 10:39:27 -07:00
Tig
fd5b52f2a0 Merge branch 'gui-cs:v2_develop' into v2_develop 2025-03-01 17:23:13 -07:00
Thomas Nind
255e5d6643 Fix driver name options shown in UICatalog for v2 (#3940)
- v2 auto picks based on OS
- v2win is the new windows interop driver
- v2net is the new dotnet core cross platform driver

Co-authored-by: Tig <tig@users.noreply.github.com>
2025-03-01 17:22:55 -07:00