From fcad17853e78bc537650c40e8e273462a963ca0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 10:22:14 -0700 Subject: [PATCH 01/10] Bump CsvHelper from 30.0.1 to 30.0.3 (#3210) Bumps [CsvHelper](https://github.com/JoshClose/CsvHelper) from 30.0.1 to 30.0.3. - [Commits](https://github.com/JoshClose/CsvHelper/compare/30.0.1...30.0.3) --- updated-dependencies: - dependency-name: CsvHelper dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- UICatalog/UICatalog.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UICatalog/UICatalog.csproj b/UICatalog/UICatalog.csproj index 666881eae1..8c046f520b 100644 --- a/UICatalog/UICatalog.csproj +++ b/UICatalog/UICatalog.csproj @@ -22,7 +22,7 @@ - + From 4a59157f45b0c093ac0306267d67b29ef8b945b3 Mon Sep 17 00:00:00 2001 From: Qin Guan Date: Sun, 11 Feb 2024 22:01:11 +0800 Subject: [PATCH 02/10] docs: readme links (#3239) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e9249dadd2..f6832a1ddc 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ dotnet run ## Documentation * [Documentation Home](https://gui-cs.github.io/Terminal.Gui/index.html) -* [Terminal.Gui Overview](https://gui-cs.github.io/Terminal.Gui/articles/overview.html) -* [List of Views/Controls](https://gui-cs.github.io/Terminal.Gui/articles/views.html) -* [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/articles/index.html) -* [API Documentation](https://gui-cs.github.io/Terminal.Gui) +* [Terminal.Gui Overview](https://gui-cs.github.io/Terminal.Gui/docs/overview.html) +* [List of Views/Controls](https://gui-cs.github.io/Terminal.Gui/docs/views.html) +* [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/docs/index.html) +* [API Documentation](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui) _The Documentation matches the most recent Nuget release from the `main` branch ([![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui))_ From 54bcaa8c732983535c3bfbedb5bba23e8b7eeb95 Mon Sep 17 00:00:00 2001 From: Tig Date: Thu, 22 Feb 2024 06:50:50 -0700 Subject: [PATCH 03/10] V1 Updates nuget packages and fixes a unit test issue (#3259) * Updated to use Nstack v1.1.1 * Updated nuget refs and fixed unit test namespace error * readme fix * Lame change to .sln to try to force build action * Try to fix test action * Try to fix test action 2 * Try to fix test action 3 --- .github/workflows/dotnet-core.yml | 34 +++++++++++++------------- README.md | 1 - ReactiveExample/ReactiveExample.csproj | 4 +-- Terminal.Gui/Terminal.Gui.csproj | 3 +-- UICatalog/UICatalog.csproj | 2 +- UnitTests/UnitTests.csproj | 10 ++++---- UnitTests/Views/ViewDisposalTest.cs | 2 +- 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 774d22060d..f5e5ee42c2 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -34,23 +34,23 @@ jobs: - name: Test run: | sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json - dotnet test --no-restore --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings - mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/ + dotnet test --no-restore --verbosity normal #--collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings + #mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/ # Note: this step is currently not writing to the gist for some reason - - name: Create Test Coverage Badge - uses: simon-k/dotnet-code-coverage-badge@v1.0.0 - id: create_coverage_badge - with: - label: Unit Test Coverage - color: brightgreen - path: UnitTests/TestResults/coverage.opencover.xml - gist-filename: code-coverage.json - # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27 - gist-id: 90ef67a684cb71db1817921a970f8d27 - gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }} + # - name: Create Test Coverage Badge + # uses: simon-k/dotnet-code-coverage-badge@v1.0.0 + # id: create_coverage_badge + # with: + # label: Unit Test Coverage + # color: brightgreen + # path: UnitTests/TestResults/coverage.opencover.xml + # gist-filename: code-coverage.json + # # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27 + # gist-id: 90ef67a684cb71db1817921a970f8d27 + # gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }} - - name: Print Code Coverage - run: | - echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%" - echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}" + # - name: Print Code Coverage + # run: | + # echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%" + # echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}" diff --git a/README.md b/README.md index f6832a1ddc..f54b58bf8a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ ![Terminal.Gui](https://socialify.git.ci/gui-cs/Terminal.Gui/image?description=1&font=Rokkitt&forks=1&language=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2Fgui-cs%2FTerminal.Gui%2Fdevelop%2Fdocfx%2Fimages%2Flogo.png&name=1&owner=1&pattern=Circuit%20Board&stargazers=1&theme=Auto) ![.NET Core](https://github.com/gui-cs/Terminal.Gui/workflows/.NET%20Core/badge.svg?branch=develop) -![Code scanning - action](https://github.com/gui-cs/Terminal.Gui/workflows/Code%20scanning%20-%20action/badge.svg) [![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui) ![Code Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27/raw/code-coverage.json) [![Downloads](https://img.shields.io/nuget/dt/Terminal.Gui)](https://www.nuget.org/packages/Terminal.Gui) diff --git a/ReactiveExample/ReactiveExample.csproj b/ReactiveExample/ReactiveExample.csproj index 0452d960ef..55eaefa28c 100644 --- a/ReactiveExample/ReactiveExample.csproj +++ b/ReactiveExample/ReactiveExample.csproj @@ -10,8 +10,8 @@ 1.14.0-pre.1+Branch.develop.Sha.e0b7464669ef87b96b57f2285200e02bcf85d0e7--> - - + + diff --git a/Terminal.Gui/Terminal.Gui.csproj b/Terminal.Gui/Terminal.Gui.csproj index 600ab80b3b..94f9582380 100644 --- a/Terminal.Gui/Terminal.Gui.csproj +++ b/Terminal.Gui/Terminal.Gui.csproj @@ -80,7 +80,7 @@ README.md csharp, terminal, c#, f#, gui, toolkit, console, tui Cross platform Terminal UI toolkit for .NET - Miguel de Icaza, Tig Kindel + Tig Kindel A toolkit for building rich console apps for .NET that works on Windows, Mac, and Linux/Unix. Terminal.Gui - Cross platform Terminal User Interface (TUI) toolkit for .NET @@ -100,7 +100,6 @@ true true - Miguel de Icaza, Tig Kindel (@tig), @BDisp True Terminal.Gui.snk diff --git a/UICatalog/UICatalog.csproj b/UICatalog/UICatalog.csproj index 8c046f520b..d246dd6ea3 100644 --- a/UICatalog/UICatalog.csproj +++ b/UICatalog/UICatalog.csproj @@ -22,7 +22,7 @@ - + diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 48323fb1e2..1cad938d99 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -18,15 +18,15 @@ TRACE;DEBUG_IDISPOSABLE - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/UnitTests/Views/ViewDisposalTest.cs b/UnitTests/Views/ViewDisposalTest.cs index 177179bab4..95b6cd6238 100644 --- a/UnitTests/Views/ViewDisposalTest.cs +++ b/UnitTests/Views/ViewDisposalTest.cs @@ -7,7 +7,7 @@ using Xunit; using Xunit.Abstractions; -namespace UnitTests.ViewsTests { +namespace Terminal.Gui.ViewTests { public class ViewDisposalTest { From 384735a23eeb5499686d26b91b729c6ce6435ae2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 14:59:22 +0000 Subject: [PATCH 04/10] Bump ReportGenerator from 5.2.1 to 5.2.2 Bumps [ReportGenerator](https://github.com/danielpalme/ReportGenerator) from 5.2.1 to 5.2.2. - [Release notes](https://github.com/danielpalme/ReportGenerator/releases) - [Commits](https://github.com/danielpalme/ReportGenerator/compare/v5.2.1...v5.2.2) --- updated-dependencies: - dependency-name: ReportGenerator dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- UnitTests/UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 1cad938d99..d88ce47fb6 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -19,7 +19,7 @@ - + From 37e76d174d77aafa46d66523b81227ed874e1fc4 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 13 Mar 2024 21:09:32 +0000 Subject: [PATCH 05/10] Fixes #3318. v1-MouseClick should be invoked only once on a mouse click. --- Terminal.Gui/Core/View.cs | 11 ++++++++--- UnitTests/Views/ViewTests.cs | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 174abd94bc..7ba0ae4be3 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -2894,9 +2894,14 @@ public virtual bool OnMouseEvent (MouseEvent mouseEvent) return false; } - var args = new MouseEventArgs (mouseEvent); - if (OnMouseClick (args)) - return true; + if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked) || mouseEvent.Flags.HasFlag (MouseFlags.Button2Clicked) + || mouseEvent.Flags.HasFlag (MouseFlags.Button3Clicked) || mouseEvent.Flags.HasFlag (MouseFlags.Button4Clicked)) { + + var args = new MouseEventArgs (mouseEvent); + if (OnMouseClick (args)) { + return true; + } + } if (MouseEvent (mouseEvent)) return true; diff --git a/UnitTests/Views/ViewTests.cs b/UnitTests/Views/ViewTests.cs index 2f161d9065..8e8691726f 100644 --- a/UnitTests/Views/ViewTests.cs +++ b/UnitTests/Views/ViewTests.cs @@ -4581,5 +4581,19 @@ public void View_Instance_Use_Attribute_Normal_On_Draw () 011110 000000", new Attribute [] { Colors.TopLevel.Normal, Colors.TopLevel.Focus }); } + + [Fact] + public void OnMouseClick_Is_Only_Fired_Once () + { + var mouseClicks = 0; + var view = new View (); + view.MouseClick += (_) => mouseClicks++; + + view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Pressed }); + view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Released }); + view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Clicked }); + + Assert.Equal (1, mouseClicks); + } } } From 157a32312bca0fe6b507c2b8a5aa417595b729de Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 13 Mar 2024 21:17:35 +0000 Subject: [PATCH 06/10] Fixes #3317. Listvew mouse event doesn't cause a SelectedItemChanged event to fire --- Terminal.Gui/Views/ListView.cs | 2 -- UnitTests/Views/ListViewTests.cs | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index 3e38092be3..36d9d64b33 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -802,8 +802,6 @@ public override bool MouseEvent (MouseEvent me) selected = top + me.Y; if (AllowsAll ()) { Source.SetMark (SelectedItem, !Source.IsMarked (SelectedItem)); - SetNeedsDisplay (); - return true; } OnSelectedChanged (); SetNeedsDisplay (); diff --git a/UnitTests/Views/ListViewTests.cs b/UnitTests/Views/ListViewTests.cs index 145caf85d0..2241c355f0 100644 --- a/UnitTests/Views/ListViewTests.cs +++ b/UnitTests/Views/ListViewTests.cs @@ -545,5 +545,24 @@ tem 2 tem 3 tem 4", output); } + + [Fact] + public void SelectedItemChanged_Event_Is_Also_Fired_With_AllowsMarking_True_By_Keyboard_Or_Mouse () + { + var itemChanged = 0; + var lv = new ListView (new List () { "Item1", "Item2", "Item3" }) { Width = 5, Height = 3, AllowsMarking = true }; + lv.SelectedItemChanged += (e) => itemChanged = e.Item; + + Assert.Equal (0, lv.SelectedItem); + Assert.Equal (lv.SelectedItem, itemChanged); + + Assert.True (lv.ProcessKey (new KeyEvent (Key.CursorDown, new KeyModifiers()))); + Assert.Equal (1, lv.SelectedItem); + Assert.Equal (lv.SelectedItem, itemChanged); + + Assert.True (lv.MouseEvent (new MouseEvent(){ X = 0, Y = 2, Flags = MouseFlags.Button1Clicked})); + Assert.Equal (2, lv.SelectedItem); + Assert.Equal (lv.SelectedItem, itemChanged); + } } } From 4eabd71b165f2c4d79b416d915ee80a57ddaa1a8 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 13 Mar 2024 21:45:11 +0000 Subject: [PATCH 07/10] Reformat only for re-test the CI. --- Terminal.Gui/Views/ListView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index 36d9d64b33..3ccdc03959 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -875,7 +875,7 @@ void RenderUstr (ConsoleDriver driver, ustring ustr, int col, int line, int widt /// public void Render (ListView container, ConsoleDriver driver, bool marked, int item, int col, int line, int width, int start = 0) { - var savedClip = container.ClipToBounds(); + var savedClip = container.ClipToBounds (); container.Move (col - start, line); var t = src? [item]; if (t == null) { From b1218d743699703e5d1d06ee6fef6e087c0f6e82 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 14 Mar 2024 11:29:16 +0000 Subject: [PATCH 08/10] Rename to Raised. --- UnitTests/Views/ListViewTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTests/Views/ListViewTests.cs b/UnitTests/Views/ListViewTests.cs index 2241c355f0..f705dab25f 100644 --- a/UnitTests/Views/ListViewTests.cs +++ b/UnitTests/Views/ListViewTests.cs @@ -547,7 +547,7 @@ tem 3 } [Fact] - public void SelectedItemChanged_Event_Is_Also_Fired_With_AllowsMarking_True_By_Keyboard_Or_Mouse () + public void SelectedItemChanged_Event_Is_Also_Raised_With_AllowsMarking_True_By_Keyboard_Or_Mouse () { var itemChanged = 0; var lv = new ListView (new List () { "Item1", "Item2", "Item3" }) { Width = 5, Height = 3, AllowsMarking = true }; From e08e873139ec2c88759b68b9cabaf8f528adf59d Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 14 Mar 2024 11:47:49 +0000 Subject: [PATCH 09/10] Rename to Raised. --- UnitTests/Views/ViewTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTests/Views/ViewTests.cs b/UnitTests/Views/ViewTests.cs index 8e8691726f..251f5f4597 100644 --- a/UnitTests/Views/ViewTests.cs +++ b/UnitTests/Views/ViewTests.cs @@ -4583,7 +4583,7 @@ public void View_Instance_Use_Attribute_Normal_On_Draw () } [Fact] - public void OnMouseClick_Is_Only_Fired_Once () + public void OnMouseClick_Is_Only_Raised_Once () { var mouseClicks = 0; var view = new View (); From 1724e71601d3342ab9f207c78b1db9926a656cae Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 14 Mar 2024 11:57:51 +0000 Subject: [PATCH 10/10] Using mask check instead of HasFlag method. --- Terminal.Gui/Core/View.cs | 4 ++-- UnitTests/Views/ViewTests.cs | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 7ba0ae4be3..c89d433d26 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -2894,8 +2894,8 @@ public virtual bool OnMouseEvent (MouseEvent mouseEvent) return false; } - if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Clicked) || mouseEvent.Flags.HasFlag (MouseFlags.Button2Clicked) - || mouseEvent.Flags.HasFlag (MouseFlags.Button3Clicked) || mouseEvent.Flags.HasFlag (MouseFlags.Button4Clicked)) { + if ((mouseEvent.Flags & MouseFlags.Button1Clicked) != 0 || (mouseEvent.Flags & MouseFlags.Button2Clicked) != 0 + || (mouseEvent.Flags & MouseFlags.Button3Clicked) != 0 || (mouseEvent.Flags & MouseFlags.Button4Clicked) != 0) { var args = new MouseEventArgs (mouseEvent); if (OnMouseClick (args)) { diff --git a/UnitTests/Views/ViewTests.cs b/UnitTests/Views/ViewTests.cs index 251f5f4597..dc366989db 100644 --- a/UnitTests/Views/ViewTests.cs +++ b/UnitTests/Views/ViewTests.cs @@ -4582,16 +4582,18 @@ public void View_Instance_Use_Attribute_Normal_On_Draw () 000000", new Attribute [] { Colors.TopLevel.Normal, Colors.TopLevel.Focus }); } - [Fact] - public void OnMouseClick_Is_Only_Raised_Once () + [Theory] + [InlineData (MouseFlags.Button1Pressed, MouseFlags.Button1Released, MouseFlags.Button1Clicked)] + [InlineData (MouseFlags.Button1Pressed | MouseFlags.ButtonCtrl, MouseFlags.Button1Released | MouseFlags.ButtonCtrl, MouseFlags.Button1Clicked | MouseFlags.ButtonCtrl)] + public void OnMouseClick_Is_Only_Raised_Once (MouseFlags pressed, MouseFlags released, MouseFlags clicked) { var mouseClicks = 0; var view = new View (); view.MouseClick += (_) => mouseClicks++; - view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Pressed }); - view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Released }); - view.OnMouseEvent (new MouseEvent () { Flags = MouseFlags.Button1Clicked }); + view.OnMouseEvent (new MouseEvent () { Flags = pressed }); + view.OnMouseEvent (new MouseEvent () { Flags = released }); + view.OnMouseEvent (new MouseEvent () { Flags = clicked }); Assert.Equal (1, mouseClicks); }