Skip to content

Commit d774f62

Browse files
committed
Merge branch 'develop'
2 parents 5ec744f + 85a759c commit d774f62

23 files changed

+129
-40
lines changed

.github/workflows/api-docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
continue-on-error: false
3232

3333
- name: Setup Pages
34-
uses: actions/configure-pages@v4
34+
uses: actions/configure-pages@v5
3535

3636
- name: Upload artifact
3737
uses: actions/upload-pages-artifact@v2

.github/workflows/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
fetch-depth: 0 # fetch-depth is needed for GitVersion
2020

2121
- name: Install GitVersion
22-
uses: gittools/actions/gitversion/setup@v0
22+
uses: gittools/actions/gitversion/setup@v1
2323
with:
2424
versionSpec: '5.x'
2525
includePrerelease: true
2626

2727
- name: Determine Version
28-
uses: gittools/actions/gitversion/execute@v0
28+
uses: gittools/actions/gitversion/execute@v1
2929
with:
3030
useConfigFile: true
3131
#additionalArguments: /b develop
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup dotnet
3535
uses: actions/setup-dotnet@v4
3636
with:
37-
dotnet-version: 7.0
37+
dotnet-version: 8.0
3838
dotnet-quality: 'ga'
3939

4040
- name: Install dependencies

Example/Example.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<!-- Version numbers are automatically updated by gitversion when a release is released -->
66
<!-- Do not modify these. -->
77
<FileVersion>1.0.0.0</FileVersion>

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dotnet run
4040

4141
_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))_
4242

43-
See the [`Terminal.Gui/` README](https://github.com/gui-cs/Terminal.Gui/tree/master/Terminal.Gui) for an overview of how the library is structured. The [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/articles/index.html) provides insight into core concepts.
43+
See the [`Terminal.Gui/` README](https://github.com/gui-cs/Terminal.Gui/tree/master/Terminal.Gui) for an overview of how the library is structured. The [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/docs/index.html) provides insight into core concepts.
4444

4545
## Features
4646

ReactiveExample/ReactiveExample.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<!-- Version numbers are automatically updated by gitversion when a release is released -->
66
<!-- Do not modify these. -->
77
<!--<AssemblyVersion>1.14.0.0</AssemblyVersion>
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212
<ItemGroup>
1313
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
14-
<PackageReference Include="ReactiveUI" Version="19.5.41" />
14+
<PackageReference Include="ReactiveUI" Version="20.1.1" />
1515
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" PrivateAssets="all" />
1616
</ItemGroup>
1717
<ItemGroup>

Showcase.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
![PoshDotnetDumpAnalyzerViewer.png](docfx/images/PoshDotnetDumpAnalyzerViewer.png)
1717
1818
* **[TerminalGuiDesigner](https://github.com/tznind/TerminalGuiDesigner)** - Cross platform view designer for building Terminal.Gui applications.
19-
![TerminalGuiDesigner.gif](docfx/images/TerminalGuiDesigner.gif)
19+
![TerminalGuiDesigner.gif](docfx/images/TerminalGuiDesigner.gif)
20+
21+
* **[Capital and Cargo](https://github.com/dhorions/Capital-and-Cargo)** - A retro console game where you buy, sell, produce and transport goods built with Terminal.Gui
22+
![image](https://github.com/gui-cs/Terminal.Gui/assets/1682004/ed89f3d6-020f-4a8a-ae18-e057514f4c43)
23+
2024

2125
# Examples #
2226

2327
* **[C# Example](https://github.com/gui-cs/Terminal.Gui/tree/master/Example)** - Run `dotnet run` in the `Example` directory to run the C# Example.
2428
* **[F# Example](https://github.com/gui-cs/Terminal.Gui/tree/master/FSharpExample)** - An example showing how to build a Terminal.Gui app using F#.
25-
* **[Reactive Example](https://github.com/gui-cs/Terminal.Gui/tree/master/ReactiveExample)** - A sample app that shows how to use `System.Reactive` and `ReactiveUI` with `Terminal.Gui`. The app uses the MVVM architecture that may seem familiar to folks coming from WPF, Xamarin Forms, UWP, Avalonia, or Windows Forms. In this app, we implement the data bindings using ReactiveUI `WhenAnyValue` syntax and [Pharmacist](https://github.com/reactiveui/pharmacist) — a tool that converts all events in a NuGet package into observable wrappers.
29+
* **[Reactive Example](https://github.com/gui-cs/Terminal.Gui/tree/master/ReactiveExample)** - A sample app that shows how to use `System.Reactive` and `ReactiveUI` with `Terminal.Gui`. The app uses the MVVM architecture that may seem familiar to folks coming from WPF, Xamarin Forms, UWP, Avalonia, or Windows Forms. In this app, we implement the data bindings using ReactiveUI `WhenAnyValue` syntax and [Pharmacist](https://github.com/reactiveui/pharmacist) — a tool that converts all events in a NuGet package into observable wrappers.

Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

+1
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ void ProcessInput ()
505505
keyHandler (key);
506506
} else {
507507
k = Key.Esc;
508+
keyDownHandler (new KeyEvent (k, MapKeyModifiers (k)));
508509
keyHandler (new KeyEvent (k, MapKeyModifiers (k)));
509510
}
510511
} else if (wch == Curses.KeyTab) {

Terminal.Gui/Core/Application.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,7 @@ public static RunState Begin (Toplevel toplevel)
10401040
if (refreshDriver) {
10411041
MdiTop?.OnChildLoaded (toplevel);
10421042
toplevel.OnLoaded ();
1043-
Redraw (toplevel);
1044-
toplevel.PositionCursor ();
1045-
Driver.Refresh ();
1043+
Refresh ();
10461044
}
10471045

10481046
NotifyNewRunState?.Invoke (rs);

Terminal.Gui/Core/Clipboard/Clipboard.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public static ustring Contents {
5151
Application.Driver.Clipboard.SetClipboardData (value.ToString ());
5252
}
5353
contents = value;
54-
} catch (NotSupportedException e) {
55-
throw e;
54+
} catch (NotSupportedException) {
55+
throw;
5656
} catch (Exception) {
5757
contents = value;
5858
}

Terminal.Gui/Core/Event.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -753,13 +753,13 @@ public enum MouseFlags {
753753
/// </summary>
754754
WheeledDown = unchecked((int)0x20000000),
755755
/// <summary>
756-
/// Vertical button wheeled up while pressing ButtonShift.
756+
/// Vertical button wheeled up while pressing ButtonCtrl.
757757
/// </summary>
758-
WheeledLeft = ButtonShift | WheeledUp,
758+
WheeledLeft = ButtonCtrl | WheeledUp,
759759
/// <summary>
760-
/// Vertical button wheeled down while pressing ButtonShift.
760+
/// Vertical button wheeled down while pressing ButtonCtrl.
761761
/// </summary>
762-
WheeledRight = ButtonShift | WheeledDown,
762+
WheeledRight = ButtonCtrl | WheeledDown,
763763
/// <summary>
764764
/// Mask that captures all the events.
765765
/// </summary>

Terminal.Gui/Core/View.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public int TabIndex {
282282
} else if (SuperView?.tabIndexes == null || SuperView?.tabIndexes.Count == 1) {
283283
tabIndex = 0;
284284
return;
285-
} else if (tabIndex == value) {
285+
} else if (tabIndex == value && TabIndexes.IndexOf (this) == value) {
286286
return;
287287
}
288288
tabIndex = value > SuperView.tabIndexes.Count - 1 ? SuperView.tabIndexes.Count - 1 : value < 0 ? 0 : value;

Terminal.Gui/Terminal.Gui.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<DebugType>portable</DebugType>
2121
</PropertyGroup>
2222
<PropertyGroup>
23-
<TargetFrameworks>net472;netstandard2.1;net7.0</TargetFrameworks>
23+
<TargetFrameworks>net472;netstandard2.0;netstandard2.1;net7.0;net8.0</TargetFrameworks>
2424
<RootNamespace>Terminal.Gui</RootNamespace>
2525
<AssemblyName>Terminal.Gui</AssemblyName>
2626
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>

Terminal.Gui/Views/ComboBox.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ private void Reset (bool keepSearchText = false)
792792
listview.SetSource (searchset);
793793
listview.Height = CalculatetHeight ();
794794

795-
if (Subviews.Count > 0) {
795+
if (HasFocus && Subviews.Count > 0) {
796796
search.SetFocus ();
797797
}
798798
}

Terminal.Gui/Views/ListView.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,8 @@ int GetMaxLengthItem ()
864864

865865
void RenderUstr (ConsoleDriver driver, ustring ustr, int col, int line, int width, int start = 0)
866866
{
867-
var u = TextFormatter.ClipAndJustify (ustr, width + start, TextAlignment.Left);
867+
ustring str = start > ustr.ConsoleWidth ? string.Empty : ustr.Substring (Math.Min (start, ustr.ToRunes ().Length - 1));
868+
ustring u = TextFormatter.ClipAndJustify (str, width, TextAlignment.Left);
868869
driver.AddStr (u);
869870
width -= TextFormatter.GetTextWidth (u);
870871
while (width-- + start > 0) {
@@ -876,7 +877,7 @@ void RenderUstr (ConsoleDriver driver, ustring ustr, int col, int line, int widt
876877
public void Render (ListView container, ConsoleDriver driver, bool marked, int item, int col, int line, int width, int start = 0)
877878
{
878879
var savedClip = container.ClipToBounds ();
879-
container.Move (col - start, line);
880+
container.Move (Math.Max (col - start, 0), line);
880881
var t = src? [item];
881882
if (t == null) {
882883
RenderUstr (driver, ustring.Make (""), col, line, width);

Terminal.Gui/Views/ScrollView.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public override void Redraw (Rect region)
349349
{
350350
Driver.SetAttribute (GetNormalColor ());
351351
SetViewsNeedsDisplay ();
352-
//Clear ();
352+
Clear ();
353353

354354
var savedClip = ClipToBounds ();
355355
OnDrawContent (new Rect (ContentOffset,

Terminal.Gui/Windows/Wizard.cs

+4
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,10 @@ public bool GoToStep (WizardStep newStep)
773773
var oldStep = currentStep;
774774
currentStep = newStep;
775775

776+
if (currentStep is null) {
777+
return false;
778+
}
779+
776780
UpdateButtonsAndTitle ();
777781

778782
// Set focus to the nav buttons

Terminal.sln.DotSettings

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@
112112
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
113113
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
114114
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
115+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
116+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=669e5282_002Dfb4b_002D4e90_002D91e7_002D07d269d04b60/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="CONSTANT_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
117+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
115118
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=CAF4ECB3AC41AE43BD233D613AC1562C/@KeyIndexDefined">True</s:Boolean>
116119
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=CAF4ECB3AC41AE43BD233D613AC1562C/AbsolutePath/@EntryValue">Terminal.sln.DotSettings</s:String>
117120
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=CAF4ECB3AC41AE43BD233D613AC1562C/RelativePath/@EntryValue"></s:String>
@@ -125,4 +128,5 @@
125128
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
126129
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
127130
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
128-
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
131+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
132+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

UICatalog/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ENV LANG=en_US.UTF-8 \
1616
DISPLAY=:0
1717
WORKDIR /app
1818

19-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
19+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2020
WORKDIR /src
2121
COPY ["Terminal.Gui/Directory.Build.props", "Terminal.Gui/"]
2222
COPY ["UICatalog/UICatalog.csproj", "UICatalog/"]

UICatalog/Scenarios/ListViewWithSelection.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public override void Setup ()
7979
};
8080

8181
_listView.DrawContent += (e) => {
82-
_scrollBar.Size = _listView.Source.Count - 1;
82+
_scrollBar.Size = _listView.Source.Count;
8383
_scrollBar.Position = _listView.TopItem;
84-
_scrollBar.OtherScrollBarView.Size = _listView.Maxlength - 1;
84+
_scrollBar.OtherScrollBarView.Size = _listView.Maxlength;
8585
_scrollBar.OtherScrollBarView.Position = _listView.LeftItem;
8686
_scrollBar.Refresh ();
8787
};

UICatalog/UICatalog.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<LangVersion>9.0</LangVersion>
66
<StartupObject>UICatalog.UICatalogApp</StartupObject>
77
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
@@ -20,9 +20,9 @@
2020
<None Update="./Scenarios/Spinning_globe_dark_small.gif" CopyToOutputDirectory="PreserveNewest" />
2121
</ItemGroup>
2222
<ItemGroup>
23-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
24-
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.2" />
25-
<PackageReference Include="CsvHelper" Version="31.0.0" />
23+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
24+
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
25+
<PackageReference Include="CsvHelper" Version="32.0.3" />
2626
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
2727
</ItemGroup>
2828
<ItemGroup>

UnitTests/UnitTests.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFramework>net8.0</TargetFramework>
44
<!-- https://stackoverflow.com/questions/294216/why-does-c-sharp-forbid-generic-attribute-types -->
55
<!-- for AutoInitShutdown attribute -->
66
<LangVersion>Preview</LangVersion>
@@ -18,15 +18,15 @@
1818
<DefineConstants>TRACE;DEBUG_IDISPOSABLE</DefineConstants>
1919
</PropertyGroup>
2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
22-
<PackageReference Include="ReportGenerator" Version="5.2.2" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
22+
<PackageReference Include="ReportGenerator" Version="5.3.4" />
2323
<PackageReference Include="System.Collections" Version="4.3.0" />
24-
<PackageReference Include="xunit" Version="2.7.0" />
25-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
24+
<PackageReference Include="xunit" Version="2.8.1" />
25+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
2626
<PrivateAssets>all</PrivateAssets>
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
</PackageReference>
29-
<PackageReference Include="coverlet.collector" Version="6.0.1">
29+
<PackageReference Include="coverlet.collector" Version="6.0.2">
3030
<PrivateAssets>all</PrivateAssets>
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3232
</PackageReference>

UnitTests/Views/ViewTests.cs

+77
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,79 @@ public void TabIndex_Set_CanFocus_False_To_True ()
371371
Assert.True (r.TabIndexes.IndexOf (v1) == 1);
372372
}
373373

374+
[Fact]
375+
public void TabIndex_Invert_Order ()
376+
{
377+
var r = new View ();
378+
var v1 = new View () { Id = "1", CanFocus = true };
379+
var v2 = new View () { Id = "2", CanFocus = true };
380+
var v3 = new View () { Id = "3", CanFocus = true };
381+
382+
r.Add (v1, v2, v3);
383+
384+
v1.TabIndex = 2;
385+
v2.TabIndex = 1;
386+
v3.TabIndex = 0;
387+
Assert.True (r.TabIndexes.IndexOf (v1) == 2);
388+
Assert.True (r.TabIndexes.IndexOf (v2) == 1);
389+
Assert.True (r.TabIndexes.IndexOf (v3) == 0);
390+
391+
Assert.True (r.Subviews.IndexOf (v1) == 0);
392+
Assert.True (r.Subviews.IndexOf (v2) == 1);
393+
Assert.True (r.Subviews.IndexOf (v3) == 2);
394+
}
395+
396+
[Fact]
397+
public void TabIndex_Invert_Order_Added_One_By_One_Does_Not_Do_What_Is_Expected ()
398+
{
399+
var r = new View ();
400+
var v1 = new View () { Id = "1", CanFocus = true };
401+
r.Add (v1);
402+
v1.TabIndex = 2;
403+
var v2 = new View () { Id = "2", CanFocus = true };
404+
r.Add (v2);
405+
v2.TabIndex = 1;
406+
var v3 = new View () { Id = "3", CanFocus = true };
407+
r.Add (v3);
408+
v3.TabIndex = 0;
409+
410+
Assert.False (r.TabIndexes.IndexOf (v1) == 2);
411+
Assert.True (r.TabIndexes.IndexOf (v1) == 1);
412+
Assert.False (r.TabIndexes.IndexOf (v2) == 1);
413+
Assert.True (r.TabIndexes.IndexOf (v2) == 2);
414+
// Only the last is in the expected index
415+
Assert.True (r.TabIndexes.IndexOf (v3) == 0);
416+
417+
Assert.True (r.Subviews.IndexOf (v1) == 0);
418+
Assert.True (r.Subviews.IndexOf (v2) == 1);
419+
Assert.True (r.Subviews.IndexOf (v3) == 2);
420+
}
421+
422+
[Fact]
423+
public void TabIndex_Invert_Order_Mixed ()
424+
{
425+
var r = new View ();
426+
var vl1 = new View () { Id = "vl1" };
427+
var v1 = new View () { Id = "v1", CanFocus = true };
428+
var vl2 = new View () { Id = "vl2" };
429+
var v2 = new View () { Id = "v2", CanFocus = true };
430+
var vl3 = new View () { Id = "vl3" };
431+
var v3 = new View () { Id = "v3", CanFocus = true };
432+
433+
r.Add (vl1, v1, vl2, v2, vl3, v3);
434+
435+
v1.TabIndex = 2;
436+
v2.TabIndex = 1;
437+
v3.TabIndex = 0;
438+
Assert.True (r.TabIndexes.IndexOf (v1) == 4);
439+
Assert.True (r.TabIndexes.IndexOf (v2) == 2);
440+
Assert.True (r.TabIndexes.IndexOf (v3) == 0);
441+
442+
Assert.True (r.Subviews.IndexOf (v1) == 1);
443+
Assert.True (r.Subviews.IndexOf (v2) == 3);
444+
Assert.True (r.Subviews.IndexOf (v3) == 5);
445+
}
446+
374447
[Fact]
375448
public void TabStop_And_CanFocus_Are_All_True ()
376449
{
@@ -1173,6 +1246,10 @@ public void KeyPress_Handled_To_True_Prevents_Changes ()
11731246

11741247
Application.Run ();
11751248

1249+
// Ensures cleaning any keystroke.
1250+
// This was conflicting with the TestVKPacket unit test
1251+
Console.MockKeyPresses.Clear ();
1252+
11761253
// Shutdown must be called to safely clean up Application if Init has been called
11771254
Application.Shutdown ();
11781255
}

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk":{
3-
"version":"7.0.200",
3+
"version":"8.0.204",
44
"rollForward":"latestMinor"
55
}
66
}

0 commit comments

Comments
 (0)