Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7e4253c
Add class for detecting information about console in extensible way
tznind Mar 30, 2025
564e6f1
WIP - Create test for reordering
tznind Apr 3, 2025
75a7159
Change Dictionary to List and preserve TreeBuilder order
tznind Apr 3, 2025
c3aa947
Add test to ensure branch expansion/status remains consistent despite…
tznind Apr 3, 2025
387372b
Cleanup code
tznind Apr 3, 2025
222ff34
Fix regression when removed child was the selected one
tznind Apr 3, 2025
fefcb9a
Merge branch 'v2_develop' into 4009-fix-tree-ordering
tznind Apr 3, 2025
1bc647d
Revert "Add class for detecting information about console in extensib…
tznind Apr 3, 2025
05e7736
Merge branch '4009-fix-tree-ordering' of https://github.com/tznind/gu…
tznind Apr 3, 2025
bc42fc9
Code cleanup and enable nullable on Branch
tznind Apr 4, 2025
a3ab90a
Remove color scheme and driver from Branch draw
tznind Apr 4, 2025
b801ff6
Add xunit context extensions
tznind Apr 4, 2025
992cbca
Investigate codegen for xunit
tznind Apr 4, 2025
2ad5f00
Getting closer to something that works
tznind Apr 4, 2025
bb8a330
Fix code generation
tznind Apr 4, 2025
46cdc34
Further explore code gen
tznind Apr 4, 2025
356d8f1
Generate all methods in single class for easier extensibility
tznind Apr 5, 2025
cdb453f
Simplify code gen by moving parameter creation to its own method
tznind Apr 5, 2025
5697a79
Implement asserts A-I
tznind Apr 5, 2025
e86a884
Add remaining assert calls that are not obsolete
tznind Apr 5, 2025
1e2b0fa
Fix unit test
tznind Apr 5, 2025
d9b4e7b
Merge branch 'v2_develop' into xunitcodegen
tznind Apr 5, 2025
6e350ff
Roll back versions to be compatible with CI version of csharp
tznind Apr 5, 2025
7250643
Handle params and ref etc
tznind Apr 6, 2025
4553624
Fix null warning
tznind Apr 6, 2025
d67edb8
WIP - start to add integration tests for FileDialog
tznind Apr 7, 2025
63ba43d
Add ability to tab focus to specific control with simple one line del…
tznind Apr 7, 2025
d018ced
Clarify test criteria
tznind Apr 7, 2025
2e45043
Add unit tests for Ok and other ways of canceling dialog
tznind Apr 10, 2025
d48ad6b
Fix other buttons also triggering save
tznind Apr 10, 2025
27f0898
Fix for linux environment tests
tznind Apr 10, 2025
ceb4eb6
Fix for linux again
tznind Apr 10, 2025
9ae3907
Fix application null race condition - add better way of knowing if st…
tznind Apr 10, 2025
7c49349
Better fix for shutdown detection
tznind Apr 11, 2025
7339237
Add test that shows #4026 is not an issue
tznind Apr 12, 2025
f685617
Switch to `_fileSystem.Directory.GetLogicalDrives ()`
tznind Apr 12, 2025
71c7b03
Don't show duplicate MyDocuments etc
tznind Apr 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 43 additions & 50 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!-- Enable Nuget Source Link for github -->
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="[8,9)" />

<PackageVersion Include="ColorHelper" Version="[1.8.1,2)" />
<PackageVersion Include="JetBrains.Annotations" Version="[2024.3.0,)" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="[4.13,5)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="[4.13,5)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="[4.13,5)" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="[9.0.2,10)" />
<PackageVersion Include="System.IO.Abstractions" Version="[22.0.11,23)" />
<PackageVersion Include="System.Text.Json" Version="[8.0.5,9)" />
<PackageVersion Include="Wcwidth" Version="[2,3)" />

<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="[1.21.2,2)" />
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="[3.1.7,4)" />
<PackageVersion Include="CsvHelper" Version="[33.0.1,34)" />
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="[3.1.6,4)" />
<PackageVersion Include="System.CommandLine" Version="[2.0.0-beta4.22272.1,3)" />

<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />

<PackageVersion Include="CommunityToolkit.Mvvm" Version="[8.4.0,9)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="[9.0.2,10)" />
<PackageVersion Include="ReactiveUI" Version="[20.1.63,21)" />
<PackageVersion Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="[1.3.1,2)" />
<PackageVersion Include="ReactiveUI.SourceGenerators" Version="[2.1.8,3)"/>

<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[17.13,18)" />
<PackageVersion Include="Moq" Version="[4.20.72,5)" />
<PackageVersion Include="ReportGenerator" Version="[5.4.4,6)" />
<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="[22.0.11,23)" />
<PackageVersion Include="xunit" Version="[2.9.3,3)" />
<PackageVersion Include="Xunit.Combinatorial" Version="[1.6.24,2)" />
<PackageVersion Include="xunit.runner.visualstudio" Version="[2.8.2,3)"/>
<PackageVersion Include="coverlet.collector" Version="[6.0.4,7)" />

</ItemGroup>

<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PackageVersion Include="Terminal.Gui" Version="2.0.0" />
</ItemGroup>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!-- Enable Nuget Source Link for github -->
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="[8,9)" />
<PackageVersion Include="ColorHelper" Version="[1.8.1,2)" />
<PackageVersion Include="JetBrains.Annotations" Version="[2024.3.0,)" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="[4.11,4.12)" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="[4.11,4.12)" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="[9.0.2,10)" />
<PackageVersion Include="System.IO.Abstractions" Version="[22.0.11,23)" />
<PackageVersion Include="System.Text.Json" Version="[8.0.5,9)" />
<PackageVersion Include="Wcwidth" Version="[2,3)" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="[1.21.2,2)" />
<PackageVersion Include="Serilog" Version="4.2.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="[3.1.7,4)" />
<PackageVersion Include="CsvHelper" Version="[33.0.1,34)" />
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="[3.1.6,4)" />
<PackageVersion Include="System.CommandLine" Version="[2.0.0-beta4.22272.1,3)" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="[8.4.0,9)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="[9.0.2,10)" />
<PackageVersion Include="ReactiveUI" Version="[20.1.63,21)" />
<PackageVersion Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="[1.3.1,2)" />
<PackageVersion Include="ReactiveUI.SourceGenerators" Version="[2.1.8,3)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[17.13,18)" />
<PackageVersion Include="Moq" Version="[4.20.72,5)" />
<PackageVersion Include="ReportGenerator" Version="[5.4.4,6)" />
<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="[22.0.11,23)" />
<PackageVersion Include="xunit" Version="[2.9.3,3)" />
<PackageVersion Include="Xunit.Combinatorial" Version="[1.6.24,2)" />
<PackageVersion Include="xunit.runner.visualstudio" Version="[2.8.2,3)" />
<PackageVersion Include="coverlet.collector" Version="[6.0.4,7)" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PackageVersion Include="Terminal.Gui" Version="2.0.0" />
</ItemGroup>
</Project>
9 changes: 3 additions & 6 deletions Terminal.Gui/FileServices/FileDialogStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,11 @@ private Dictionary<IDirectoryInfo, string> DefaultTreeRootGetter ()

try
{
foreach (string d in GetLogicalDrives ())
foreach (string d in _fileSystem.Directory.GetLogicalDrives ())
{
IDirectoryInfo dir = _fileSystem.DirectoryInfo.New (d);

if (!roots.ContainsKey (dir))
{
roots.Add (dir, d);
}
roots.TryAdd (dir, d);
}
}
catch (Exception)
Expand All @@ -181,7 +178,7 @@ private Dictionary<IDirectoryInfo, string> DefaultTreeRootGetter ()

IDirectoryInfo dir = _fileSystem.DirectoryInfo.New (path);

if (!roots.ContainsKey (dir) && dir.Exists)
if (!roots.ContainsKey (dir) && !roots.ContainsValue (special.ToString ()) && dir.Exists)
{
roots.Add (dir, special.ToString ());
}
Expand Down
26 changes: 21 additions & 5 deletions Terminal.Gui/Views/FileDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
return;
}

e.Cancel = true;

if (Modal)
{
Application.RequestStop ();
Expand All @@ -111,15 +113,27 @@

_btnUp = new() { X = 0, Y = 1, NoPadding = true };
_btnUp.Text = GetUpButtonText ();
_btnUp.Accepting += (s, e) => _history.Up ();
_btnUp.Accepting += (s, e) =>
{
_history.Up ();
e.Cancel = true;
};

_btnBack = new() { X = Pos.Right (_btnUp) + 1, Y = 1, NoPadding = true };
_btnBack.Text = GetBackButtonText ();
_btnBack.Accepting += (s, e) => _history.Back ();
_btnBack.Accepting += (s, e) =>
{
_history.Back ();
e.Cancel = true;
};

_btnForward = new() { X = Pos.Right (_btnBack) + 1, Y = 1, NoPadding = true };
_btnForward.Text = GetForwardButtonText ();
_btnForward.Accepting += (s, e) => _history.Forward ();
_btnForward.Accepting += (s, e) =>
{
_history.Forward();
e.Cancel = true;
};

_tbPath = new() { Width = Dim.Fill (), CaptionColor = new (Color.Black) };

Expand Down Expand Up @@ -199,6 +213,8 @@

_btnToggleSplitterCollapse.Accepting += (s, e) =>
{
// Required otherwise the Save button clicks itself
e.Cancel = true;
Tile tile = _splitContainer.Tiles.ElementAt (0);

bool newState = !tile.ContentView.Visible;
Expand Down Expand Up @@ -490,7 +506,7 @@
// if no path has been provided
if (_tbPath.Text.Length <= 0)
{
Path = Environment.CurrentDirectory;
Path = _fileSystem.Directory.GetCurrentDirectory ();
}

// to streamline user experience and allow direct typing of paths
Expand Down Expand Up @@ -1228,7 +1244,7 @@
return;
}

PopoverMenu? contextMenu = new (

Check warning on line 1247 in Terminal.Gui/Views/FileDialog.cs

View workflow job for this annotation

GitHub Actions / Parallel Unit Tests (macos-latest)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 1247 in Terminal.Gui/Views/FileDialog.cs

View workflow job for this annotation

GitHub Actions / build_and_test_debug (macos-latest)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 1247 in Terminal.Gui/Views/FileDialog.cs

View workflow job for this annotation

GitHub Actions / Non-Parallel Unit Tests (windows-latest)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
[
new (Strings.fdCtxNew, string.Empty, New),
new (Strings.fdCtxRename, string.Empty, Rename),
Expand Down Expand Up @@ -1288,7 +1304,7 @@
// really not what most users would expect
if (Regex.IsMatch (path, "^\\w:$"))
{
return _fileSystem.DirectoryInfo.New (path + System.IO.Path.DirectorySeparatorChar);
return _fileSystem.DirectoryInfo.New (path + _fileSystem.Path.DirectorySeparatorChar);
}

return _fileSystem.DirectoryInfo.New (path);
Expand Down
10 changes: 9 additions & 1 deletion Terminal.Gui/Views/SaveDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// * Use a line separator to show the file listing, so we can use same colors as the rest
// * DirListView: Add mouse support

using System.IO.Abstractions;
using Terminal.Gui.Resources;

namespace Terminal.Gui;
Expand All @@ -24,8 +25,15 @@ namespace Terminal.Gui;
public class SaveDialog : FileDialog
{
/// <summary>Initializes a new <see cref="SaveDialog"/>.</summary>
public SaveDialog () { Style.OkButtonText = Strings.btnSave; }
public SaveDialog ()
{
Style.OkButtonText = Strings.btnSave;
}

internal SaveDialog (IFileSystem fileSystem) : base (fileSystem)
{
Style.OkButtonText = Strings.btnSave;
}
/// <summary>
/// Gets the name of the file the user selected for saving, or null if the user canceled the
/// <see cref="SaveDialog"/>.
Expand Down
16 changes: 11 additions & 5 deletions Terminal.sln
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Parallelizable",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerminalGuiFluentTesting", "TerminalGuiFluentTesting\TerminalGuiFluentTesting.csproj", "{2DBA7BDC-17AE-474B-A507-00807D087607}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerminalGuiFluentTesting.Xunit", "TerminalGuiFluentTesting.Xunit\TerminalGuiFluentTesting.Xunit.csproj", "{231B9723-10F3-46DB-8EAE-50C0C0375AD3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerminalGuiFluentTestingXunit", "TerminalGuiFluentTestingXunit\TerminalGuiFluentTestingXunit.csproj", "{F56BAFFD-F227-4B0A-96F0-C800FAEF2036}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerminalGuiFluentTestingXunit.Generator", "TerminalGuiFluentTestingXunit.Generator\TerminalGuiFluentTestingXunit.Generator.csproj", "{199F27D8-A905-4DDC-82CA-1FE1A90B1788}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -125,10 +127,14 @@ Global
{2DBA7BDC-17AE-474B-A507-00807D087607}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DBA7BDC-17AE-474B-A507-00807D087607}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DBA7BDC-17AE-474B-A507-00807D087607}.Release|Any CPU.Build.0 = Release|Any CPU
{231B9723-10F3-46DB-8EAE-50C0C0375AD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{231B9723-10F3-46DB-8EAE-50C0C0375AD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{231B9723-10F3-46DB-8EAE-50C0C0375AD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{231B9723-10F3-46DB-8EAE-50C0C0375AD3}.Release|Any CPU.Build.0 = Release|Any CPU
{F56BAFFD-F227-4B0A-96F0-C800FAEF2036}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F56BAFFD-F227-4B0A-96F0-C800FAEF2036}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F56BAFFD-F227-4B0A-96F0-C800FAEF2036}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F56BAFFD-F227-4B0A-96F0-C800FAEF2036}.Release|Any CPU.Build.0 = Release|Any CPU
{199F27D8-A905-4DDC-82CA-1FE1A90B1788}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{199F27D8-A905-4DDC-82CA-1FE1A90B1788}.Debug|Any CPU.Build.0 = Debug|Any CPU
{199F27D8-A905-4DDC-82CA-1FE1A90B1788}.Release|Any CPU.ActiveCfg = Release|Any CPU
{199F27D8-A905-4DDC-82CA-1FE1A90B1788}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading
Loading