diff --git a/README.md b/README.md
index 7a501dd06..ef01f27fc 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ _The Documentation matches the most recent Nuget release from the `main` branch
* **[Flexible Layout](https://gui-cs.github.io/Terminal.Gui/articles/overview.html#layout)** - Supports both *Absolute layout* and an innovative *Computed Layout* system. *Computed Layout* makes it easy to layout controls relative to each other and enables dynamic terminal UIs.
* **[Configuration & Themes](https://gui-cs.github.io/Terminal.Gui/articles/config.html)** - Terminal.Gui supports a rich configuration system that allows end-user customization of how the UI looks (e.g. colors) and behaves (e.g. key-bindings).
* **Clipboard support** - Cut, Copy, and Paste of text provided through the [`Clipboard`](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui/Terminal.Gui.Clipboard.html) class.
-* **[Arbitrary Views](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui/Terminal.Gui.View.html)** - All visible UI elements are subclasses of the `View` class, and these in turn can contain an arbitrary number of sub-views.
+* **[Arbitrary Views](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui/Terminal.Gui.ViewTests.html)** - All visible UI elements are subclasses of the `View` class, and these in turn can contain an arbitrary number of sub-views.
* **Advanced App Features** - The [Mainloop](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui/Terminal.Gui.MainLoop.html) supports processing events, idle handlers, timers, and monitoring file
descriptors. Most classes are safe for threading.
* **Reactive Extensions** - Use [reactive extensions](https://github.com/dotnet/reactive) and benefit from increased code readability, and the ability to apply the MVVM pattern and [ReactiveUI](https://www.reactiveui.net/) data bindings. See the [source code](https://github.com/gui-cs/Terminal.Gui/tree/master/ReactiveExample) of a sample app in order to learn how to achieve this.
diff --git a/Terminal.Gui/Core/Application.cs b/Terminal.Gui/Application.cs
similarity index 99%
rename from Terminal.Gui/Core/Application.cs
rename to Terminal.Gui/Application.cs
index c72ec41f5..1939fe0b7 100644
--- a/Terminal.Gui/Core/Application.cs
+++ b/Terminal.Gui/Application.cs
@@ -20,9 +20,9 @@ using System.ComponentModel;
using System.Globalization;
using System.Reflection;
using System.IO;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using System.Text.Json.Serialization;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/ClassDiagram1.cd b/Terminal.Gui/ClassDiagram1.cd
deleted file mode 100644
index 7b894197b..000000000
--- a/Terminal.Gui/ClassDiagram1.cd
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/Terminal.Gui/Core/Clipboard/Clipboard.cs b/Terminal.Gui/Clipboard/Clipboard.cs
similarity index 100%
rename from Terminal.Gui/Core/Clipboard/Clipboard.cs
rename to Terminal.Gui/Clipboard/Clipboard.cs
diff --git a/Terminal.Gui/Core/Clipboard/ClipboardBase.cs b/Terminal.Gui/Clipboard/ClipboardBase.cs
similarity index 100%
rename from Terminal.Gui/Core/Clipboard/ClipboardBase.cs
rename to Terminal.Gui/Clipboard/ClipboardBase.cs
diff --git a/Terminal.Gui/Core/Clipboard/IClipboard.cs b/Terminal.Gui/Clipboard/IClipboard.cs
similarity index 100%
rename from Terminal.Gui/Core/Clipboard/IClipboard.cs
rename to Terminal.Gui/Clipboard/IClipboard.cs
diff --git a/Terminal.Gui/Configuration/AppScope.cs b/Terminal.Gui/Configuration/AppScope.cs
index 46c7df349..da76d3d4d 100644
--- a/Terminal.Gui/Configuration/AppScope.cs
+++ b/Terminal.Gui/Configuration/AppScope.cs
@@ -5,11 +5,11 @@ using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text.Json.Serialization;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
#nullable enable
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
public static partial class ConfigurationManager {
///
diff --git a/Terminal.Gui/Configuration/AttributeJsonConverter.cs b/Terminal.Gui/Configuration/AttributeJsonConverter.cs
index 3e19fc5f1..5ef2c001e 100644
--- a/Terminal.Gui/Configuration/AttributeJsonConverter.cs
+++ b/Terminal.Gui/Configuration/AttributeJsonConverter.cs
@@ -3,7 +3,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using Terminal.Gui;
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
///
/// Json converter fro the class.
///
diff --git a/Terminal.Gui/Configuration/ColorJsonConverter.cs b/Terminal.Gui/Configuration/ColorJsonConverter.cs
index 24896df69..93ae8317e 100644
--- a/Terminal.Gui/Configuration/ColorJsonConverter.cs
+++ b/Terminal.Gui/Configuration/ColorJsonConverter.cs
@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
using System.Text.Json;
using System.Text.RegularExpressions;
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
///
/// Json converter for the class.
///
diff --git a/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs b/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
index 2f4044a22..0c036bd65 100644
--- a/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
+++ b/Terminal.Gui/Configuration/ColorSchemeJsonConverter.cs
@@ -2,7 +2,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
///
/// Implements a JSON converter for .
///
diff --git a/Terminal.Gui/Configuration/ConfigurationManager.cs b/Terminal.Gui/Configuration/ConfigurationManager.cs
index 6048294dd..d642f863c 100644
--- a/Terminal.Gui/Configuration/ConfigurationManager.cs
+++ b/Terminal.Gui/Configuration/ConfigurationManager.cs
@@ -9,11 +9,11 @@ using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
#nullable enable
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
///
/// Provides settings and configuration management for Terminal.Gui applications.
///
diff --git a/Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs b/Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs
index 74acce2ec..7e191a7df 100644
--- a/Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs
+++ b/Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs
@@ -2,7 +2,7 @@
#nullable enable
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
///
/// Event arguments for the events.
///
diff --git a/Terminal.Gui/Configuration/DictionaryJsonConverter.cs b/Terminal.Gui/Configuration/DictionaryJsonConverter.cs
index aea4bf51e..e8218e5cf 100644
--- a/Terminal.Gui/Configuration/DictionaryJsonConverter.cs
+++ b/Terminal.Gui/Configuration/DictionaryJsonConverter.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Text.Json;
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
class DictionaryJsonConverter : JsonConverter> {
public override Dictionary Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
diff --git a/Terminal.Gui/Configuration/KeyJsonConverter.cs b/Terminal.Gui/Configuration/KeyJsonConverter.cs
index 26a258f54..216689d18 100644
--- a/Terminal.Gui/Configuration/KeyJsonConverter.cs
+++ b/Terminal.Gui/Configuration/KeyJsonConverter.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
///
/// Json converter for the class.
///
diff --git a/Terminal.Gui/Configuration/Scope.cs b/Terminal.Gui/Configuration/Scope.cs
index da4e5c43f..078ff17e6 100644
--- a/Terminal.Gui/Configuration/Scope.cs
+++ b/Terminal.Gui/Configuration/Scope.cs
@@ -5,12 +5,12 @@ using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
#nullable enable
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
public static partial class ConfigurationManager {
///
diff --git a/Terminal.Gui/Configuration/SettingsScope.cs b/Terminal.Gui/Configuration/SettingsScope.cs
index 0c36af658..49d6f1839 100644
--- a/Terminal.Gui/Configuration/SettingsScope.cs
+++ b/Terminal.Gui/Configuration/SettingsScope.cs
@@ -9,7 +9,7 @@ using System.Text.Json.Serialization;
#nullable enable
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
public static partial class ConfigurationManager {
///
/// The root object of Terminal.Gui configuration settings / JSON schema. Contains only properties
diff --git a/Terminal.Gui/Configuration/ThemeScope.cs b/Terminal.Gui/Configuration/ThemeScope.cs
index 6b5ee2eb0..3bab13810 100644
--- a/Terminal.Gui/Configuration/ThemeScope.cs
+++ b/Terminal.Gui/Configuration/ThemeScope.cs
@@ -5,11 +5,11 @@ using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text.Json.Serialization;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
#nullable enable
-namespace Terminal.Gui.Configuration {
+namespace Terminal.Gui {
public static partial class ConfigurationManager {
///
diff --git a/Terminal.Gui/Core/ConsoleDriver.cs b/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
similarity index 99%
rename from Terminal.Gui/Core/ConsoleDriver.cs
rename to Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
index ce6737329..a357a173f 100644
--- a/Terminal.Gui/Core/ConsoleDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
@@ -10,8 +10,8 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
-using Terminal.Gui.Configuration;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using Terminal.Gui;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
///
@@ -187,13 +187,13 @@ namespace Terminal.Gui {
///
/// The foreground color.
///
- [JsonConverter (typeof (Configuration.ColorJsonConverter))]
+ [JsonConverter (typeof (ColorJsonConverter))]
public Color Foreground { get; }
///
/// The background color.
///
- [JsonConverter (typeof (Configuration.ColorJsonConverter))]
+ [JsonConverter (typeof (ColorJsonConverter))]
public Color Background { get; }
///
diff --git a/Terminal.Gui/Core/Graphs/LineCanvas.cs b/Terminal.Gui/Drawing/LineCanvas.cs
similarity index 99%
rename from Terminal.Gui/Core/Graphs/LineCanvas.cs
rename to Terminal.Gui/Drawing/LineCanvas.cs
index c8c7a126b..a56a18c5d 100644
--- a/Terminal.Gui/Core/Graphs/LineCanvas.cs
+++ b/Terminal.Gui/Drawing/LineCanvas.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace Terminal.Gui.Graphs {
+namespace Terminal.Gui {
///
diff --git a/Terminal.Gui/Drawing/Ruler.cs b/Terminal.Gui/Drawing/Ruler.cs
index 36484e3d8..138f6bde4 100644
--- a/Terminal.Gui/Drawing/Ruler.cs
+++ b/Terminal.Gui/Drawing/Ruler.cs
@@ -4,8 +4,6 @@ using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Text.Json.Serialization;
-using Terminal.Gui.Configuration;
-using Terminal.Gui.Graphs;
namespace Terminal.Gui {
///
diff --git a/Terminal.Gui/Core/Thickness.cs b/Terminal.Gui/Drawing/Thickness.cs
similarity index 99%
rename from Terminal.Gui/Core/Thickness.cs
rename to Terminal.Gui/Drawing/Thickness.cs
index 33e584237..e9576746a 100644
--- a/Terminal.Gui/Core/Thickness.cs
+++ b/Terminal.Gui/Drawing/Thickness.cs
@@ -3,8 +3,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
-using Terminal.Gui.Configuration;
-using Terminal.Gui.Graphs;
+using Terminal.Gui;
namespace Terminal.Gui {
///
diff --git a/Terminal.Gui/Core/ThicknessEventArgs.cs b/Terminal.Gui/Drawing/ThicknessEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/ThicknessEventArgs.cs
rename to Terminal.Gui/Drawing/ThicknessEventArgs.cs
diff --git a/Terminal.Gui/Core/Command.cs b/Terminal.Gui/Input/Command.cs
similarity index 100%
rename from Terminal.Gui/Core/Command.cs
rename to Terminal.Gui/Input/Command.cs
diff --git a/Terminal.Gui/Core/ConsoleKeyMapping.cs b/Terminal.Gui/Input/ConsoleKeyMapping.cs
similarity index 100%
rename from Terminal.Gui/Core/ConsoleKeyMapping.cs
rename to Terminal.Gui/Input/ConsoleKeyMapping.cs
diff --git a/Terminal.Gui/Core/EscSeqUtils/EscSeqReq.cs b/Terminal.Gui/Input/EscSeqUtils/EscSeqReq.cs
similarity index 100%
rename from Terminal.Gui/Core/EscSeqUtils/EscSeqReq.cs
rename to Terminal.Gui/Input/EscSeqUtils/EscSeqReq.cs
diff --git a/Terminal.Gui/Core/EscSeqUtils/EscSeqUtils.cs b/Terminal.Gui/Input/EscSeqUtils/EscSeqUtils.cs
similarity index 100%
rename from Terminal.Gui/Core/EscSeqUtils/EscSeqUtils.cs
rename to Terminal.Gui/Input/EscSeqUtils/EscSeqUtils.cs
diff --git a/Terminal.Gui/Core/Event.cs b/Terminal.Gui/Input/Event.cs
similarity index 100%
rename from Terminal.Gui/Core/Event.cs
rename to Terminal.Gui/Input/Event.cs
diff --git a/Terminal.Gui/Core/GrabMouseEventArgs.cs b/Terminal.Gui/Input/GrabMouseEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/GrabMouseEventArgs.cs
rename to Terminal.Gui/Input/GrabMouseEventArgs.cs
diff --git a/Terminal.Gui/Core/KeyChangedEventArgs.cs b/Terminal.Gui/Input/KeyChangedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/KeyChangedEventArgs.cs
rename to Terminal.Gui/Input/KeyChangedEventArgs.cs
diff --git a/Terminal.Gui/Core/KeyEventEventArgs.cs b/Terminal.Gui/Input/KeyEventEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/KeyEventEventArgs.cs
rename to Terminal.Gui/Input/KeyEventEventArgs.cs
diff --git a/Terminal.Gui/Core/KeystrokeNavigatorEventArgs.cs b/Terminal.Gui/Input/KeystrokeNavigatorEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/KeystrokeNavigatorEventArgs.cs
rename to Terminal.Gui/Input/KeystrokeNavigatorEventArgs.cs
diff --git a/Terminal.Gui/Core/MouseEventEventArgs.cs b/Terminal.Gui/Input/MouseEventEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/MouseEventEventArgs.cs
rename to Terminal.Gui/Input/MouseEventEventArgs.cs
diff --git a/Terminal.Gui/Core/MouseFlagsChangedEventArgs.cs b/Terminal.Gui/Input/MouseFlagsChangedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/MouseFlagsChangedEventArgs.cs
rename to Terminal.Gui/Input/MouseFlagsChangedEventArgs.cs
diff --git a/Terminal.Gui/Core/PointEventArgs.cs b/Terminal.Gui/Input/PointEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/PointEventArgs.cs
rename to Terminal.Gui/Input/PointEventArgs.cs
diff --git a/Terminal.Gui/Core/Responder.cs b/Terminal.Gui/Input/Responder.cs
similarity index 100%
rename from Terminal.Gui/Core/Responder.cs
rename to Terminal.Gui/Input/Responder.cs
diff --git a/Terminal.Gui/Core/ShortcutHelper.cs b/Terminal.Gui/Input/ShortcutHelper.cs
similarity index 100%
rename from Terminal.Gui/Core/ShortcutHelper.cs
rename to Terminal.Gui/Input/ShortcutHelper.cs
diff --git a/Terminal.Gui/Core/MainLoop.cs b/Terminal.Gui/MainLoop.cs
similarity index 100%
rename from Terminal.Gui/Core/MainLoop.cs
rename to Terminal.Gui/MainLoop.cs
diff --git a/Terminal.Gui/README.md b/Terminal.Gui/README.md
index 81d337f30..a8b431e91 100644
--- a/Terminal.Gui/README.md
+++ b/Terminal.Gui/README.md
@@ -4,21 +4,42 @@ All files required to build the **Terminal.Gui** library (and NuGet package).
## Project Folder Structure
-- `Terminal.Gui.sln` - The Visual Studio solution
-- `Core/` - Source files for all types that comprise the core building blocks of **Terminal-Gui**
- - `Application` - A `static` class that provides the base 'application driver'. Given it defines a **Terminal.Gui** application it is both logically and literally (because `static`) a singleton. It has direct dependencies on `MainLoop`, `Events.cs` `NetDriver`, `CursesDriver`, `WindowsDriver`, `Responder`, `View`, and `TopLevel` (and nothing else).
- - `MainLoop` - Defines `IMainLoopDriver` and implements the `MainLoop` class.
- - `ConsoleDriver` - Definition for the Console Driver API.
- - `Events.cs` - Defines keyboard and mouse-related structs & classes.
- - `PosDim.cs` - Implements *Computed Layout* system. These classes have deep dependencies on `View`.
- - `Responder` - Base class for the windowing class hierarchy. Implements support for keyboard & mouse input.
- - `View` - Derived from `Responder`, the base class for non-modal visual elements such as controls.
- - `Toplevel` - Derived from `View`, the base class for modal visual elements such as top-level windows and dialogs. Supports the concept of `MenuBar` and `StatusBar`.
- - `Window` - Derived from `TopLevel`; implements toplevel views with a visible frame and Title.
+- `\` - The root folder contains the source code for the library.
+ - `Terminal.Gui.sln` - The Visual Studio solution
+ - `Application.cs` - A `static` class that provides the base 'application driver'. Given it defines a **Terminal.Gui** application it is both logically and literally (because `static`) a singleton. It has direct dependencies on `MainLoop`, `Events.cs` `NetDriver`, `CursesDriver`, `WindowsDriver`, `Responder`, `View`, and `TopLevel` (and nothing else).
+ - `MainLoop.cs` - Defines `IMainLoopDriver` and implements the `MainLoop` class.
+ - A few supporting class files
+
+- `ConsoleDrivers\`
+ - `ConsoleDriver.cs` - Definition for the Console Driver API.
+ - Source files for the three `ConsoleDriver`-based drivers: .NET: `NetDriver`, Unix & Mac: `UnixDriver`, and Windows: `WindowsDriver`.
+
+- `Configuration\` - Classes related the `ConfigurationManager`.
+
+- `Clipboard\` - Classes related to clipboard access.
+
+- `Input\` - Classes relating to keyboard and mouse input. Includes `Responder`, which is the base class for `View`
+ - `Events.cs` - Defines keyboard and mouse-related structs & classes.
+ - `Responder` - Base class for the windowing class hierarchy. Implements support for keyboard & mouse input.
+ - etc...
+
+- `Text\` - Classes related to text processing
+
+- `Drawing\` - Classes related to drawing
+
+- `View\` - The `View` class heirarchy, not including any sub-classes
+ - `View.cs` - Derived from `Responder`, the base class for non-modal visual elements such as controls.
+ - `Layout\`
+ - `PosDim.cs` - Implements *Computed Layout* system. These classes have deep dependencies on `View`.
+
+- `Views\` - Sub-classes of `View`
+ - `Toplevel` - Derived from `View`, the base class for modal visual elements such as top-level windows and dialogs. Supports the concept of `MenuBar` and `StatusBar`.
+ - `Window` - Derived from `TopLevel`; implements toplevel views with a visible frame and Title.
+ - `Dialog` -
+ - etc...
+
- `Types/` - A folder (not namespace) containing implementations of `Point`, `Rect`, and `Size` which are ancient versions of the modern `System.Drawing.Point`, `System.Drawing.Size`, and `System.Drawning.Rectangle`.
-- `ConsoleDrivers/` - Source files for the three `ConsoleDriver`-based drivers: .NET: `NetDriver`, Unix & Mac: `UnixDriver`, and Windows: `WindowsDriver`.
-- `Views/` - A folder (not namespace) containing the source for all built-in classes that drive from `View` (non-modals).
-- `Windows/` - A folder (not namespace) containing the source of all built-in classes that derive from `Window`.
+
## Version numbers
diff --git a/Terminal.Gui/Core/RunStateEventArgs.cs b/Terminal.Gui/RunStateEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/RunStateEventArgs.cs
rename to Terminal.Gui/RunStateEventArgs.cs
diff --git a/Terminal.Gui/Core/StackExtensions.cs b/Terminal.Gui/StackExtensions.cs
similarity index 100%
rename from Terminal.Gui/Core/StackExtensions.cs
rename to Terminal.Gui/StackExtensions.cs
diff --git a/Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs b/Terminal.Gui/Text/Autocomplete/AppendAutocomplete.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/AppendAutocomplete.cs
rename to Terminal.Gui/Text/Autocomplete/AppendAutocomplete.cs
diff --git a/Terminal.Gui/Core/Autocomplete/Autocomplete.cd b/Terminal.Gui/Text/Autocomplete/Autocomplete.cd
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/Autocomplete.cd
rename to Terminal.Gui/Text/Autocomplete/Autocomplete.cd
diff --git a/Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs b/Terminal.Gui/Text/Autocomplete/AutocompleteBase.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/AutocompleteBase.cs
rename to Terminal.Gui/Text/Autocomplete/AutocompleteBase.cs
diff --git a/Terminal.Gui/Core/Autocomplete/AutocompleteContext.cs b/Terminal.Gui/Text/Autocomplete/AutocompleteContext.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/AutocompleteContext.cs
rename to Terminal.Gui/Text/Autocomplete/AutocompleteContext.cs
diff --git a/Terminal.Gui/Core/Autocomplete/IAutocomplete.cs b/Terminal.Gui/Text/Autocomplete/IAutocomplete.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/IAutocomplete.cs
rename to Terminal.Gui/Text/Autocomplete/IAutocomplete.cs
diff --git a/Terminal.Gui/Core/Autocomplete/ISuggestionGenerator.cs b/Terminal.Gui/Text/Autocomplete/ISuggestionGenerator.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/ISuggestionGenerator.cs
rename to Terminal.Gui/Text/Autocomplete/ISuggestionGenerator.cs
diff --git a/Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs b/Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/PopupAutocomplete.cs
rename to Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs
diff --git a/Terminal.Gui/Core/Autocomplete/SingleWordSuggestionGenerator.cs b/Terminal.Gui/Text/Autocomplete/SingleWordSuggestionGenerator.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/SingleWordSuggestionGenerator.cs
rename to Terminal.Gui/Text/Autocomplete/SingleWordSuggestionGenerator.cs
diff --git a/Terminal.Gui/Core/Autocomplete/Suggestion.cs b/Terminal.Gui/Text/Autocomplete/Suggestion.cs
similarity index 100%
rename from Terminal.Gui/Core/Autocomplete/Suggestion.cs
rename to Terminal.Gui/Text/Autocomplete/Suggestion.cs
diff --git a/Terminal.Gui/Core/CollectionNavigator.cs b/Terminal.Gui/Text/CollectionNavigator.cs
similarity index 100%
rename from Terminal.Gui/Core/CollectionNavigator.cs
rename to Terminal.Gui/Text/CollectionNavigator.cs
diff --git a/Terminal.Gui/Core/TextFormatter.cs b/Terminal.Gui/Text/TextFormatter.cs
similarity index 100%
rename from Terminal.Gui/Core/TextFormatter.cs
rename to Terminal.Gui/Text/TextFormatter.cs
diff --git a/Terminal.Gui/Core/TimeoutEventArgs.cs b/Terminal.Gui/TimeoutEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/TimeoutEventArgs.cs
rename to Terminal.Gui/TimeoutEventArgs.cs
diff --git a/Terminal.Gui/Core/Border.cs b/Terminal.Gui/View/Border.cs
similarity index 94%
rename from Terminal.Gui/Core/Border.cs
rename to Terminal.Gui/View/Border.cs
index 8bddc5b80..80fe7c853 100644
--- a/Terminal.Gui/Core/Border.cs
+++ b/Terminal.Gui/View/Border.cs
@@ -1,6 +1,5 @@
using NStack;
using System;
-using Terminal.Gui.Graphs;
using System.Text.Json.Serialization;
using System.Data;
using System.Text;
@@ -63,7 +62,7 @@ namespace Terminal.Gui {
///
/// Gets or sets the that draws the outer border color.
///
- [JsonInclude, JsonConverter (typeof (Configuration.ColorJsonConverter))]
+ [JsonInclude, JsonConverter (typeof (ColorJsonConverter))]
public Color ForgroundColor {
get => _forgroundColor;
set {
@@ -75,7 +74,7 @@ namespace Terminal.Gui {
///
/// Gets or sets the that fills the area between the bounds of a .
///
- [JsonInclude, JsonConverter (typeof (Configuration.ColorJsonConverter))]
+ [JsonInclude, JsonConverter (typeof (ColorJsonConverter))]
public Color BackgroundColor {
get => _backgroundColor;
set {
diff --git a/Terminal.Gui/Core/Frame.cs b/Terminal.Gui/View/Frame.cs
similarity index 99%
rename from Terminal.Gui/Core/Frame.cs
rename to Terminal.Gui/View/Frame.cs
index e89752ba2..6bc6c7c5e 100644
--- a/Terminal.Gui/Core/Frame.cs
+++ b/Terminal.Gui/View/Frame.cs
@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Linq;
-using Terminal.Gui.Graphs;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Core/PosDim.cs b/Terminal.Gui/View/Layout/PosDim.cs
similarity index 100%
rename from Terminal.Gui/Core/PosDim.cs
rename to Terminal.Gui/View/Layout/PosDim.cs
diff --git a/Terminal.Gui/Core/ResizedEventArgs.cs b/Terminal.Gui/View/Layout/ResizedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/ResizedEventArgs.cs
rename to Terminal.Gui/View/Layout/ResizedEventArgs.cs
diff --git a/Terminal.Gui/Core/SizeChangedEventArgs.cs b/Terminal.Gui/View/Layout/SizeChangedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/SizeChangedEventArgs.cs
rename to Terminal.Gui/View/Layout/SizeChangedEventArgs.cs
diff --git a/Terminal.Gui/Core/SuperViewChangedEventArgs.cs b/Terminal.Gui/View/SuperViewChangedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/SuperViewChangedEventArgs.cs
rename to Terminal.Gui/View/SuperViewChangedEventArgs.cs
diff --git a/Terminal.Gui/Core/TitleEventArgs.cs b/Terminal.Gui/View/TitleEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/TitleEventArgs.cs
rename to Terminal.Gui/View/TitleEventArgs.cs
diff --git a/Terminal.Gui/Core/ToggleEventArgs.cs b/Terminal.Gui/View/ToggleEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/ToggleEventArgs.cs
rename to Terminal.Gui/View/ToggleEventArgs.cs
diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/View/View.cs
similarity index 100%
rename from Terminal.Gui/Core/View.cs
rename to Terminal.Gui/View/View.cs
diff --git a/Terminal.Gui/Core/ViewEventArgs.cs b/Terminal.Gui/View/ViewEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/ViewEventArgs.cs
rename to Terminal.Gui/View/ViewEventArgs.cs
diff --git a/Terminal.Gui/Windows/Dialog.cs b/Terminal.Gui/Views/Dialog.cs
similarity index 98%
rename from Terminal.Gui/Windows/Dialog.cs
rename to Terminal.Gui/Views/Dialog.cs
index bed044823..8b7203c6b 100644
--- a/Terminal.Gui/Windows/Dialog.cs
+++ b/Terminal.Gui/Views/Dialog.cs
@@ -9,8 +9,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using NStack;
-using Terminal.Gui.Configuration;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using Terminal.Gui;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
///
diff --git a/Terminal.Gui/Windows/FileDialog.cs b/Terminal.Gui/Views/FileDialog.cs
similarity index 100%
rename from Terminal.Gui/Windows/FileDialog.cs
rename to Terminal.Gui/Views/FileDialog.cs
diff --git a/Terminal.Gui/Views/FrameView.cs b/Terminal.Gui/Views/FrameView.cs
index 78d67ecdf..5e9133eb8 100644
--- a/Terminal.Gui/Views/FrameView.cs
+++ b/Terminal.Gui/Views/FrameView.cs
@@ -2,7 +2,7 @@
using System.Linq;
using System.Text.Json.Serialization;
using NStack;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
///
diff --git a/Terminal.Gui/Core/Graphs/Annotations.cs b/Terminal.Gui/Views/GraphView/Annotations.cs
similarity index 99%
rename from Terminal.Gui/Core/Graphs/Annotations.cs
rename to Terminal.Gui/Views/GraphView/Annotations.cs
index 226aab839..bdfbad122 100644
--- a/Terminal.Gui/Core/Graphs/Annotations.cs
+++ b/Terminal.Gui/Views/GraphView/Annotations.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace Terminal.Gui.Graphs {
+namespace Terminal.Gui {
///
/// Describes an overlay element that is rendered either before or
/// after a series.
diff --git a/Terminal.Gui/Core/Graphs/Axis.cs b/Terminal.Gui/Views/GraphView/Axis.cs
similarity index 99%
rename from Terminal.Gui/Core/Graphs/Axis.cs
rename to Terminal.Gui/Views/GraphView/Axis.cs
index 847d55fce..8e4fbf0ea 100644
--- a/Terminal.Gui/Core/Graphs/Axis.cs
+++ b/Terminal.Gui/Views/GraphView/Axis.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace Terminal.Gui.Graphs {
+namespace Terminal.Gui {
///
/// Renders a continuous line with grid line ticks and labels
diff --git a/Terminal.Gui/Core/Graphs/GraphCellToRender.cs b/Terminal.Gui/Views/GraphView/GraphCellToRender.cs
similarity index 97%
rename from Terminal.Gui/Core/Graphs/GraphCellToRender.cs
rename to Terminal.Gui/Views/GraphView/GraphCellToRender.cs
index 402fafef3..46586a747 100644
--- a/Terminal.Gui/Core/Graphs/GraphCellToRender.cs
+++ b/Terminal.Gui/Views/GraphView/GraphCellToRender.cs
@@ -1,6 +1,6 @@
using System;
-namespace Terminal.Gui.Graphs {
+namespace Terminal.Gui {
///
/// Describes how to render a single row/column of a based
/// on the value(s) in at that location
diff --git a/Terminal.Gui/Views/GraphView.cs b/Terminal.Gui/Views/GraphView/GraphView.cs
similarity index 99%
rename from Terminal.Gui/Views/GraphView.cs
rename to Terminal.Gui/Views/GraphView/GraphView.cs
index 48c62a760..668175880 100644
--- a/Terminal.Gui/Views/GraphView.cs
+++ b/Terminal.Gui/Views/GraphView/GraphView.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Terminal.Gui.Graphs;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Core/Graphs/Orientation.cs b/Terminal.Gui/Views/GraphView/Orientation.cs
similarity index 87%
rename from Terminal.Gui/Core/Graphs/Orientation.cs
rename to Terminal.Gui/Views/GraphView/Orientation.cs
index 1b7d34a02..73eb0fe9a 100644
--- a/Terminal.Gui/Core/Graphs/Orientation.cs
+++ b/Terminal.Gui/Views/GraphView/Orientation.cs
@@ -1,4 +1,4 @@
-namespace Terminal.Gui.Graphs {
+namespace Terminal.Gui {
///
/// Direction of an element (horizontal or vertical)
///
diff --git a/Terminal.Gui/Core/Graphs/Series.cs b/Terminal.Gui/Views/GraphView/Series.cs
similarity index 99%
rename from Terminal.Gui/Core/Graphs/Series.cs
rename to Terminal.Gui/Views/GraphView/Series.cs
index 48b66e37d..bf7040a01 100644
--- a/Terminal.Gui/Core/Graphs/Series.cs
+++ b/Terminal.Gui/Views/GraphView/Series.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-namespace Terminal.Gui.Graphs {
+namespace Terminal.Gui {
///
/// Describes a series of data that can be rendered into a >
///
diff --git a/Terminal.Gui/Views/LineView.cs b/Terminal.Gui/Views/LineView.cs
index fa3f87b0d..a84c8b4cf 100644
--- a/Terminal.Gui/Views/LineView.cs
+++ b/Terminal.Gui/Views/LineView.cs
@@ -1,5 +1,4 @@
using System;
-using Terminal.Gui.Graphs;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Windows/MessageBox.cs b/Terminal.Gui/Views/MessageBox.cs
similarity index 99%
rename from Terminal.Gui/Windows/MessageBox.cs
rename to Terminal.Gui/Views/MessageBox.cs
index 5af8b9c57..b46d7b9fa 100644
--- a/Terminal.Gui/Windows/MessageBox.cs
+++ b/Terminal.Gui/Views/MessageBox.cs
@@ -1,8 +1,8 @@
using NStack;
using System;
using System.Collections.Generic;
-using Terminal.Gui.Configuration;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using Terminal.Gui;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
///
diff --git a/Terminal.Gui/Core/ReadOnlyCollectionExtensions.cs b/Terminal.Gui/Views/ReadOnlyCollectionExtensions.cs
similarity index 100%
rename from Terminal.Gui/Core/ReadOnlyCollectionExtensions.cs
rename to Terminal.Gui/Views/ReadOnlyCollectionExtensions.cs
diff --git a/Terminal.Gui/Views/CellActivatedEventArgs.cs b/Terminal.Gui/Views/TableView/CellActivatedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Views/CellActivatedEventArgs.cs
rename to Terminal.Gui/Views/TableView/CellActivatedEventArgs.cs
diff --git a/Terminal.Gui/Views/SelectedCellChangedEventArgs.cs b/Terminal.Gui/Views/TableView/SelectedCellChangedEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Views/SelectedCellChangedEventArgs.cs
rename to Terminal.Gui/Views/TableView/SelectedCellChangedEventArgs.cs
diff --git a/Terminal.Gui/Views/TableView.cs b/Terminal.Gui/Views/TableView/TableView.cs
similarity index 100%
rename from Terminal.Gui/Views/TableView.cs
rename to Terminal.Gui/Views/TableView/TableView.cs
diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs
index be3b73784..8ca6634ff 100644
--- a/Terminal.Gui/Views/TextView.cs
+++ b/Terminal.Gui/Views/TextView.cs
@@ -9,7 +9,6 @@ using System.Text;
using System.Threading;
using NStack;
using Terminal.Gui.Resources;
-using static Terminal.Gui.Graphs.PathAnnotation;
using Rune = System.Rune;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Views/TileView.cs b/Terminal.Gui/Views/TileView.cs
index 6dc9ef5db..14db0582c 100644
--- a/Terminal.Gui/Views/TileView.cs
+++ b/Terminal.Gui/Views/TileView.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Terminal.Gui.Graphs;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs
similarity index 100%
rename from Terminal.Gui/Core/Toplevel.cs
rename to Terminal.Gui/Views/Toplevel.cs
diff --git a/Terminal.Gui/Core/ToplevelEventArgs.cs b/Terminal.Gui/Views/ToplevelEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Core/ToplevelEventArgs.cs
rename to Terminal.Gui/Views/ToplevelEventArgs.cs
diff --git a/Terminal.Gui/Core/Trees/AspectGetterDelegate.cs b/Terminal.Gui/Views/TreeView/AspectGetterDelegate.cs
similarity index 90%
rename from Terminal.Gui/Core/Trees/AspectGetterDelegate.cs
rename to Terminal.Gui/Views/TreeView/AspectGetterDelegate.cs
index 0afe47f90..3afc1031b 100644
--- a/Terminal.Gui/Core/Trees/AspectGetterDelegate.cs
+++ b/Terminal.Gui/Views/TreeView/AspectGetterDelegate.cs
@@ -1,5 +1,5 @@
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Delegates of this type are used to fetch string representations of user's model objects
diff --git a/Terminal.Gui/Core/Trees/Branch.cs b/Terminal.Gui/Views/TreeView/Branch.cs
similarity index 99%
rename from Terminal.Gui/Core/Trees/Branch.cs
rename to Terminal.Gui/Views/TreeView/Branch.cs
index ce699af6b..f09fd14f3 100644
--- a/Terminal.Gui/Core/Trees/Branch.cs
+++ b/Terminal.Gui/Views/TreeView/Branch.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
class Branch where T : class {
///
/// True if the branch is expanded to reveal child branches.
diff --git a/Terminal.Gui/Core/Trees/DelegateTreeBuilder.cs b/Terminal.Gui/Views/TreeView/DelegateTreeBuilder.cs
similarity index 98%
rename from Terminal.Gui/Core/Trees/DelegateTreeBuilder.cs
rename to Terminal.Gui/Views/TreeView/DelegateTreeBuilder.cs
index a277b49cc..0c1834851 100644
--- a/Terminal.Gui/Core/Trees/DelegateTreeBuilder.cs
+++ b/Terminal.Gui/Views/TreeView/DelegateTreeBuilder.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Implementation of that uses user defined functions
///
diff --git a/Terminal.Gui/Core/Trees/ITreeBuilder.cs b/Terminal.Gui/Views/TreeView/ITreeBuilder.cs
similarity index 97%
rename from Terminal.Gui/Core/Trees/ITreeBuilder.cs
rename to Terminal.Gui/Views/TreeView/ITreeBuilder.cs
index d23d00f77..94b7d43bd 100644
--- a/Terminal.Gui/Core/Trees/ITreeBuilder.cs
+++ b/Terminal.Gui/Views/TreeView/ITreeBuilder.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Interface for supplying data to a on demand as root level nodes
/// are expanded by the user
diff --git a/Terminal.Gui/Core/Trees/ObjectActivatedEventArgs.cs b/Terminal.Gui/Views/TreeView/ObjectActivatedEventArgs.cs
similarity index 96%
rename from Terminal.Gui/Core/Trees/ObjectActivatedEventArgs.cs
rename to Terminal.Gui/Views/TreeView/ObjectActivatedEventArgs.cs
index e4dd95af7..46c576076 100644
--- a/Terminal.Gui/Core/Trees/ObjectActivatedEventArgs.cs
+++ b/Terminal.Gui/Views/TreeView/ObjectActivatedEventArgs.cs
@@ -1,4 +1,4 @@
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Event args for the event
///
diff --git a/Terminal.Gui/Core/Trees/SelectionChangedEventArgs.cs b/Terminal.Gui/Views/TreeView/SelectionChangedEventArgs.cs
similarity index 96%
rename from Terminal.Gui/Core/Trees/SelectionChangedEventArgs.cs
rename to Terminal.Gui/Views/TreeView/SelectionChangedEventArgs.cs
index b84687f4a..eb1b3d70f 100644
--- a/Terminal.Gui/Core/Trees/SelectionChangedEventArgs.cs
+++ b/Terminal.Gui/Views/TreeView/SelectionChangedEventArgs.cs
@@ -1,6 +1,6 @@
using System;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Event arguments describing a change in selected object in a tree view
///
diff --git a/Terminal.Gui/Core/Trees/TreeBuilder.cs b/Terminal.Gui/Views/TreeView/TreeBuilder.cs
similarity index 97%
rename from Terminal.Gui/Core/Trees/TreeBuilder.cs
rename to Terminal.Gui/Views/TreeView/TreeBuilder.cs
index 15c4e806d..f93970481 100644
--- a/Terminal.Gui/Core/Trees/TreeBuilder.cs
+++ b/Terminal.Gui/Views/TreeView/TreeBuilder.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Abstract implementation of .
diff --git a/Terminal.Gui/Core/Trees/TreeNode.cs b/Terminal.Gui/Views/TreeView/TreeNode.cs
similarity index 98%
rename from Terminal.Gui/Core/Trees/TreeNode.cs
rename to Terminal.Gui/Views/TreeView/TreeNode.cs
index 379f8f7f2..5ae07ae19 100644
--- a/Terminal.Gui/Core/Trees/TreeNode.cs
+++ b/Terminal.Gui/Views/TreeView/TreeNode.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Interface to implement when you want the regular (non generic)
diff --git a/Terminal.Gui/Core/Trees/TreeNodeBuilder.cs b/Terminal.Gui/Views/TreeView/TreeNodeBuilder.cs
similarity index 95%
rename from Terminal.Gui/Core/Trees/TreeNodeBuilder.cs
rename to Terminal.Gui/Views/TreeView/TreeNodeBuilder.cs
index c81aa8aef..8369d0ce0 100644
--- a/Terminal.Gui/Core/Trees/TreeNodeBuilder.cs
+++ b/Terminal.Gui/Views/TreeView/TreeNodeBuilder.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// implementation for objects
///
diff --git a/Terminal.Gui/Core/Trees/TreeStyle.cs b/Terminal.Gui/Views/TreeView/TreeStyle.cs
similarity index 98%
rename from Terminal.Gui/Core/Trees/TreeStyle.cs
rename to Terminal.Gui/Views/TreeView/TreeStyle.cs
index 744ed6974..12a636b26 100644
--- a/Terminal.Gui/Core/Trees/TreeStyle.cs
+++ b/Terminal.Gui/Views/TreeView/TreeStyle.cs
@@ -1,6 +1,6 @@
using System;
-namespace Terminal.Gui.Trees {
+namespace Terminal.Gui {
///
/// Defines rendering options that affect how the tree is displayed.
///
diff --git a/Terminal.Gui/Views/TreeView.cs b/Terminal.Gui/Views/TreeView/TreeView.cs
similarity index 99%
rename from Terminal.Gui/Views/TreeView.cs
rename to Terminal.Gui/Views/TreeView/TreeView.cs
index 0b619e893..e69c42e34 100644
--- a/Terminal.Gui/Views/TreeView.cs
+++ b/Terminal.Gui/Views/TreeView/TreeView.cs
@@ -7,7 +7,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using Terminal.Gui.Trees;
+using Terminal.Gui;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Core/Window.cs b/Terminal.Gui/Views/Window.cs
similarity index 98%
rename from Terminal.Gui/Core/Window.cs
rename to Terminal.Gui/Views/Window.cs
index e5cb0f623..b0ac74b57 100644
--- a/Terminal.Gui/Core/Window.cs
+++ b/Terminal.Gui/Views/Window.cs
@@ -2,8 +2,8 @@
using System.Collections;
using System.Text.Json.Serialization;
using NStack;
-using Terminal.Gui.Configuration;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using Terminal.Gui;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
diff --git a/Terminal.Gui/Windows/Wizard.cs b/Terminal.Gui/Views/Wizard/Wizard.cs
similarity index 100%
rename from Terminal.Gui/Windows/Wizard.cs
rename to Terminal.Gui/Views/Wizard/Wizard.cs
diff --git a/Terminal.Gui/Windows/WizardEventArgs.cs b/Terminal.Gui/Views/Wizard/WizardEventArgs.cs
similarity index 100%
rename from Terminal.Gui/Windows/WizardEventArgs.cs
rename to Terminal.Gui/Views/Wizard/WizardEventArgs.cs
diff --git a/UICatalog/Scenario.cs b/UICatalog/Scenario.cs
index 88c58a114..d52c45ac3 100644
--- a/UICatalog/Scenario.cs
+++ b/UICatalog/Scenario.cs
@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
namespace UICatalog {
///
diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs
index c1db8ba62..febe96012 100644
--- a/UICatalog/Scenarios/AllViewsTester.cs
+++ b/UICatalog/Scenarios/AllViewsTester.cs
@@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection;
using System.Text;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "All Views Tester", Description: "Provides a test UI for all classes derived from View.")]
diff --git a/UICatalog/Scenarios/ClassExplorer.cs b/UICatalog/Scenarios/ClassExplorer.cs
index acbc6b539..7f282bbe1 100644
--- a/UICatalog/Scenarios/ClassExplorer.cs
+++ b/UICatalog/Scenarios/ClassExplorer.cs
@@ -5,7 +5,6 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Terminal.Gui;
-using Terminal.Gui.Trees;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/CollectionNavigatorTester.cs b/UICatalog/Scenarios/CollectionNavigatorTester.cs
index ca09bfed3..993e993b8 100644
--- a/UICatalog/Scenarios/CollectionNavigatorTester.cs
+++ b/UICatalog/Scenarios/CollectionNavigatorTester.cs
@@ -1,8 +1,6 @@
using System;
-using System.IO;
using System.Linq;
using Terminal.Gui;
-using Terminal.Gui.Trees;
namespace UICatalog.Scenarios {
@@ -107,7 +105,7 @@ namespace UICatalog.Scenarios {
_items.Sort (StringComparer.OrdinalIgnoreCase);
CreateListView ();
- var vsep = new LineView (Terminal.Gui.Graphs.Orientation.Vertical) {
+ var vsep = new LineView (Orientation.Vertical) {
X = Pos.Right (_listView),
Y = 1,
Height = Dim.Fill ()
diff --git a/UICatalog/Scenarios/ComputedLayout.cs b/UICatalog/Scenarios/ComputedLayout.cs
index 6647f062f..62afd54d3 100644
--- a/UICatalog/Scenarios/ComputedLayout.cs
+++ b/UICatalog/Scenarios/ComputedLayout.cs
@@ -5,7 +5,6 @@ using System.Linq;
using System.Reflection;
using System.Text;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
namespace UICatalog.Scenarios {
///
diff --git a/UICatalog/Scenarios/ConfigurationEditor.cs b/UICatalog/Scenarios/ConfigurationEditor.cs
index ebb4bb435..758a48a3f 100644
--- a/UICatalog/Scenarios/ConfigurationEditor.cs
+++ b/UICatalog/Scenarios/ConfigurationEditor.cs
@@ -1,13 +1,9 @@
-using NStack;
-using System;
-using System.Diagnostics.Metrics;
+using System;
using System.IO;
using System.Linq;
using System.Reflection;
-using System.Text.Json.Serialization;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
using Attribute = Terminal.Gui.Attribute;
namespace UICatalog.Scenarios {
@@ -49,7 +45,7 @@ namespace UICatalog.Scenarios {
_tileView = new TileView (0) {
Width = Dim.Fill (),
Height = Dim.Fill (1),
- Orientation = Terminal.Gui.Graphs.Orientation.Vertical,
+ Orientation = Orientation.Vertical,
Border = new Border () { BorderStyle = BorderStyle.Single }
};
diff --git a/UICatalog/Scenarios/CsvEditor.cs b/UICatalog/Scenarios/CsvEditor.cs
index a9e300e6c..971a6587c 100644
--- a/UICatalog/Scenarios/CsvEditor.cs
+++ b/UICatalog/Scenarios/CsvEditor.cs
@@ -1,14 +1,11 @@
using System;
-using System.Collections.Generic;
using System.Data;
-using Terminal.Gui;
-using Terminal.Gui.Trees;
using System.Linq;
using System.Globalization;
using System.IO;
-using System.Text;
-using NStack;
using System.Text.RegularExpressions;
+using NStack;
+using Terminal.Gui;
using CsvHelper;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/Dialogs.cs b/UICatalog/Scenarios/Dialogs.cs
index eb8a43c73..0d7124eac 100644
--- a/UICatalog/Scenarios/Dialogs.cs
+++ b/UICatalog/Scenarios/Dialogs.cs
@@ -1,10 +1,7 @@
using NStack;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Dialogs", Description: "Demonstrates how to the Dialog class")]
diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs
index 64a03d9a5..b2ae6aa14 100644
--- a/UICatalog/Scenarios/Editor.cs
+++ b/UICatalog/Scenarios/Editor.cs
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
-using Terminal.Gui;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Globalization;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Editor", Description: "A Text Editor using the TextView control.")]
diff --git a/UICatalog/Scenarios/Frames.cs b/UICatalog/Scenarios/Frames.cs
index 0d6041048..39ad35977 100644
--- a/UICatalog/Scenarios/Frames.cs
+++ b/UICatalog/Scenarios/Frames.cs
@@ -1,9 +1,6 @@
-using System.Globalization;
-using System;
-using Terminal.Gui;
+using System;
using System.Linq;
-using NStack;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Frames Demo", Description: "Demonstrates Margin, Border, and Padding on Views.")]
diff --git a/UICatalog/Scenarios/Generic.cs b/UICatalog/Scenarios/Generic.cs
index 9f9085a29..f2719bccb 100644
--- a/UICatalog/Scenarios/Generic.cs
+++ b/UICatalog/Scenarios/Generic.cs
@@ -1,9 +1,4 @@
-using NStack;
-using System;
-using System.Reflection.Emit;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
-using Label = Terminal.Gui.Label;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Generic", Description: "Generic sample - A template for creating new Scenarios")]
diff --git a/UICatalog/Scenarios/GraphViewExample.cs b/UICatalog/Scenarios/GraphViewExample.cs
index 300250545..d822200ae 100644
--- a/UICatalog/Scenarios/GraphViewExample.cs
+++ b/UICatalog/Scenarios/GraphViewExample.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using Terminal.Gui;
-using Terminal.Gui.Graphs;
using Color = Terminal.Gui.Color;
diff --git a/UICatalog/Scenarios/InteractiveTree.cs b/UICatalog/Scenarios/InteractiveTree.cs
index cf581b725..e6b576f20 100644
--- a/UICatalog/Scenarios/InteractiveTree.cs
+++ b/UICatalog/Scenarios/InteractiveTree.cs
@@ -1,11 +1,6 @@
using System;
-using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Terminal.Gui;
-using Terminal.Gui.Trees;
-using static UICatalog.Scenario;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/Keys.cs b/UICatalog/Scenarios/Keys.cs
index 796103c2c..2354fb60c 100644
--- a/UICatalog/Scenarios/Keys.cs
+++ b/UICatalog/Scenarios/Keys.cs
@@ -1,7 +1,6 @@
using NStack;
using System.Collections.Generic;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Keys", Description: "Shows how to handle keyboard input")]
diff --git a/UICatalog/Scenarios/LineDrawing.cs b/UICatalog/Scenarios/LineDrawing.cs
index f5670c0c4..c31ec65d0 100644
--- a/UICatalog/Scenarios/LineDrawing.cs
+++ b/UICatalog/Scenarios/LineDrawing.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Reflection.Metadata.Ecma335;
using Terminal.Gui;
-using Terminal.Gui.Graphs;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/LineViewExample.cs b/UICatalog/Scenarios/LineViewExample.cs
index a4e4e7ac4..13fe14397 100644
--- a/UICatalog/Scenarios/LineViewExample.cs
+++ b/UICatalog/Scenarios/LineViewExample.cs
@@ -73,7 +73,7 @@ namespace UICatalog.Scenarios {
Win.Add (new Label ("Vertical Line") { Y = 9,X=11 });
// creates a horizontal line
- var verticalLine = new LineView (Terminal.Gui.Graphs.Orientation.Vertical) {
+ var verticalLine = new LineView (Orientation.Vertical) {
X = 25,
};
@@ -83,7 +83,7 @@ namespace UICatalog.Scenarios {
Win.Add (new Label ("Vertical Arrow") { Y = 11, X = 28 });
// creates a horizontal line
- var verticalArrow = new LineView (Terminal.Gui.Graphs.Orientation.Vertical) {
+ var verticalArrow = new LineView (Orientation.Vertical) {
X = 27,
StartingAnchor = Application.Driver.TopTee,
EndingAnchor = 'V'
diff --git a/UICatalog/Scenarios/Notepad.cs b/UICatalog/Scenarios/Notepad.cs
index d88c42890..33ce0d92a 100644
--- a/UICatalog/Scenarios/Notepad.cs
+++ b/UICatalog/Scenarios/Notepad.cs
@@ -2,7 +2,6 @@
using System.IO;
using System.Linq;
using Terminal.Gui;
-using Terminal.Gui.Graphs;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/Snake.cs b/UICatalog/Scenarios/Snake.cs
index e07f97c3f..d609dee7d 100644
--- a/UICatalog/Scenarios/Snake.cs
+++ b/UICatalog/Scenarios/Snake.cs
@@ -4,7 +4,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Terminal.Gui;
-using Terminal.Gui.Graphs;
using Attribute = Terminal.Gui.Attribute;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/TileViewExperiment.cs b/UICatalog/Scenarios/TileViewExperiment.cs
index 6182e1e70..47ff81e8b 100644
--- a/UICatalog/Scenarios/TileViewExperiment.cs
+++ b/UICatalog/Scenarios/TileViewExperiment.cs
@@ -1,6 +1,5 @@
using System;
using Terminal.Gui;
-using Terminal.Gui.Graphs;
using System.Linq;
namespace UICatalog.Scenarios {
diff --git a/UICatalog/Scenarios/TileViewNesting.cs b/UICatalog/Scenarios/TileViewNesting.cs
index f5f58466f..a6b0d1d8f 100644
--- a/UICatalog/Scenarios/TileViewNesting.cs
+++ b/UICatalog/Scenarios/TileViewNesting.cs
@@ -1,6 +1,5 @@
using System;
using Terminal.Gui;
-using Terminal.Gui.Graphs;
using System.Linq;
namespace UICatalog.Scenarios {
@@ -104,8 +103,8 @@ namespace UICatalog.Scenarios {
}
var root = CreateTileView (1, (bool)startHorizontal ?
- Terminal.Gui.Graphs.Orientation.Horizontal :
- Terminal.Gui.Graphs.Orientation.Vertical);
+ Orientation.Horizontal :
+ Orientation.Vertical);
root.Tiles.ElementAt (0).ContentView.Add (CreateContentControl (1));
root.Tiles.ElementAt (0).Title = (bool)cbTitles.Checked ? $"View 1" : string.Empty;
diff --git a/UICatalog/Scenarios/TreeUseCases.cs b/UICatalog/Scenarios/TreeUseCases.cs
index eeba69ee3..00f339bbb 100644
--- a/UICatalog/Scenarios/TreeUseCases.cs
+++ b/UICatalog/Scenarios/TreeUseCases.cs
@@ -1,9 +1,6 @@
-using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using Terminal.Gui;
-using Terminal.Gui.Trees;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "Tree View", Description: "Simple tree view examples.")]
diff --git a/UICatalog/Scenarios/TreeViewFileSystem.cs b/UICatalog/Scenarios/TreeViewFileSystem.cs
index 73b0d8a94..10be681d7 100644
--- a/UICatalog/Scenarios/TreeViewFileSystem.cs
+++ b/UICatalog/Scenarios/TreeViewFileSystem.cs
@@ -2,9 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Reflection.PortableExecutable;
using Terminal.Gui;
-using Terminal.Gui.Trees;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "File System Explorer", Description: "Hierarchical file system explorer demonstrating TreeView.")]
diff --git a/UICatalog/Scenarios/ViewExperiments.cs b/UICatalog/Scenarios/ViewExperiments.cs
index f84e94236..3a809dd4e 100644
--- a/UICatalog/Scenarios/ViewExperiments.cs
+++ b/UICatalog/Scenarios/ViewExperiments.cs
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using Terminal.Gui;
-using Terminal.Gui.Configuration;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "_ View Experiments", Description: "v2 View Experiments")]
diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs
index 228b7deaf..32ab01163 100644
--- a/UICatalog/UICatalog.cs
+++ b/UICatalog/UICatalog.cs
@@ -10,10 +10,8 @@ using Terminal.Gui;
using System.IO;
using System.Reflection;
using System.Threading;
-using Terminal.Gui.Configuration;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
using System.Text.Json.Serialization;
-using System.ComponentModel.DataAnnotations;
#nullable enable
@@ -243,7 +241,7 @@ namespace UICatalog {
static MenuItem []? _themeMenuItems;
static MenuBarItem? _themeMenuBarItem;
-
+
///
/// This is the main UI Catalog app view. It is run fresh when the app loads (if a Scenario has not been passed on
/// the command line) and each time a Scenario ends.
@@ -331,7 +329,7 @@ namespace UICatalog {
AllowsMarking = false,
CanFocus = true,
};
- CategoryListView.OpenSelectedItem += (s,a) => {
+ CategoryListView.OpenSelectedItem += (s, a) => {
ScenarioListView!.SetFocus ();
};
CategoryListView.SelectedItemChanged += CategoryListView_SelectedChanged;
@@ -370,7 +368,7 @@ namespace UICatalog {
ConfigurationManager.Applied += ConfigAppliedHandler;
}
-
+
void LoadedHandler (object? sender, EventArgs? args)
{
ConfigChanged ();
@@ -405,7 +403,7 @@ namespace UICatalog {
ConfigurationManager.Applied -= ConfigAppliedHandler;
Unloaded -= UnloadedHandler;
}
-
+
void ConfigAppliedHandler (object? sender, ConfigurationManagerEventArgs? a)
{
ConfigChanged ();
diff --git a/UnitTests/Application/ApplicationTests.cs b/UnitTests/Application/ApplicationTests.cs
index 4a291b6c0..12736d9d8 100644
--- a/UnitTests/Application/ApplicationTests.cs
+++ b/UnitTests/Application/ApplicationTests.cs
@@ -468,7 +468,6 @@ namespace Terminal.Gui.ApplicationTests {
((FakeDriver)Application.Driver).SetBufferSize (5, 5);
Application.Begin (Application.Top);
- // BUGBUG: v2 -
Assert.Equal (new Rect (0, 0, 80, 25), Application.Top.Frame);
((FakeDriver)Application.Driver).SetBufferSize (5, 5);
Assert.Equal (new Rect (0, 0, 5, 5), Application.Top.Frame);
diff --git a/UnitTests/Drivers/ClipboardTests.cs b/UnitTests/Clipboard/ClipboardTests.cs
similarity index 99%
rename from UnitTests/Drivers/ClipboardTests.cs
rename to UnitTests/Clipboard/ClipboardTests.cs
index 90f30bdbd..67d62923d 100644
--- a/UnitTests/Drivers/ClipboardTests.cs
+++ b/UnitTests/Clipboard/ClipboardTests.cs
@@ -6,7 +6,7 @@ using Xunit;
using Xunit.Abstractions;
using static AutoInitShutdownAttribute;
-namespace Terminal.Gui.DriverTests {
+namespace Terminal.Gui.ClipboardTests {
public class ClipboardTests {
readonly ITestOutputHelper output;
diff --git a/UnitTests/Configuration/AppScopeTests.cs b/UnitTests/Configuration/AppScopeTests.cs
index a04603041..743de08b1 100644
--- a/UnitTests/Configuration/AppScopeTests.cs
+++ b/UnitTests/Configuration/AppScopeTests.cs
@@ -1,12 +1,12 @@
using Xunit;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui.ConfigurationTests {
public class AppScopeTests {
diff --git a/UnitTests/Configuration/ConfigurationMangerTests.cs b/UnitTests/Configuration/ConfigurationMangerTests.cs
index 73ae84b14..605f1bcee 100644
--- a/UnitTests/Configuration/ConfigurationMangerTests.cs
+++ b/UnitTests/Configuration/ConfigurationMangerTests.cs
@@ -5,9 +5,10 @@ using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text.Json;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using Xunit;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
+using Attribute = Terminal.Gui.Attribute;
namespace Terminal.Gui.ConfigurationTests {
public class ConfigurationManagerTests {
diff --git a/UnitTests/Configuration/JsonConverterTests.cs b/UnitTests/Configuration/JsonConverterTests.cs
index 8e87ab719..ece53145a 100644
--- a/UnitTests/Configuration/JsonConverterTests.cs
+++ b/UnitTests/Configuration/JsonConverterTests.cs
@@ -1,11 +1,12 @@
using Xunit;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
+using Attribute = Terminal.Gui.Attribute;
namespace Terminal.Gui.ConfigurationTests {
public class ColorJsonConverterTests {
diff --git a/UnitTests/Configuration/SettingsScopeTests.cs b/UnitTests/Configuration/SettingsScopeTests.cs
index 040c564bd..06777daf1 100644
--- a/UnitTests/Configuration/SettingsScopeTests.cs
+++ b/UnitTests/Configuration/SettingsScopeTests.cs
@@ -1,11 +1,11 @@
using Xunit;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui.ConfigurationTests {
public class SettingsScopeTests {
diff --git a/UnitTests/Configuration/ThemeScopeTests.cs b/UnitTests/Configuration/ThemeScopeTests.cs
index 24066365f..34199a008 100644
--- a/UnitTests/Configuration/ThemeScopeTests.cs
+++ b/UnitTests/Configuration/ThemeScopeTests.cs
@@ -1,12 +1,12 @@
using Xunit;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui.ConfigurationTests {
public class ThemeScopeTests {
diff --git a/UnitTests/Configuration/ThemeTests.cs b/UnitTests/Configuration/ThemeTests.cs
index f13dca9d3..f8679324a 100644
--- a/UnitTests/Configuration/ThemeTests.cs
+++ b/UnitTests/Configuration/ThemeTests.cs
@@ -1,5 +1,5 @@
using Xunit;
-using Terminal.Gui.Configuration;
+using Terminal.Gui;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +7,8 @@ using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.Json;
-using static Terminal.Gui.Configuration.ConfigurationManager;
+using static Terminal.Gui.ConfigurationManager;
+using Attribute = Terminal.Gui.Attribute;
namespace Terminal.Gui.ConfigurationTests {
public class ThemeTests {
diff --git a/UnitTests/Colors/AttributeTests.cs b/UnitTests/ConsoleDrivers/AttributeTests.cs
similarity index 99%
rename from UnitTests/Colors/AttributeTests.cs
rename to UnitTests/ConsoleDrivers/AttributeTests.cs
index 0bcdc991f..f2130f220 100644
--- a/UnitTests/Colors/AttributeTests.cs
+++ b/UnitTests/ConsoleDrivers/AttributeTests.cs
@@ -7,7 +7,7 @@ using Xunit;
// Alias Console to MockConsole so we don't accidentally use Console
using Console = Terminal.Gui.FakeConsole;
-namespace Terminal.Gui.ColorTests {
+namespace Terminal.Gui.DriverTests {
public class AttributeTests {
[Fact]
public void Constuctors_Constuct ()
diff --git a/UnitTests/Drivers/ColorTests.cs b/UnitTests/ConsoleDrivers/ColorTests.cs
similarity index 100%
rename from UnitTests/Drivers/ColorTests.cs
rename to UnitTests/ConsoleDrivers/ColorTests.cs
diff --git a/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs b/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs
new file mode 100644
index 000000000..30757e981
--- /dev/null
+++ b/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs
@@ -0,0 +1,298 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Xunit;
+using Xunit.Abstractions;
+
+// Alias Console to MockConsole so we don't accidentally use Console
+using Console = Terminal.Gui.FakeConsole;
+
+namespace Terminal.Gui.DriverTests {
+ public class ConsoleDriverTests {
+ readonly ITestOutputHelper output;
+
+ public ConsoleDriverTests (ITestOutputHelper output)
+ {
+ this.output = output;
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ //[InlineData (typeof (NetDriver))]
+ //[InlineData (typeof (CursesDriver))]
+ //[InlineData (typeof (WindowsDriver))]
+ public void Init_Inits (Type driverType)
+ {
+ var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+ driver.Init (() => { });
+
+ Assert.Equal (80, Console.BufferWidth);
+ Assert.Equal (25, Console.BufferHeight);
+
+ // MockDriver is always 80x25
+ Assert.Equal (Console.BufferWidth, driver.Cols);
+ Assert.Equal (Console.BufferHeight, driver.Rows);
+ driver.End ();
+
+ // Shutdown must be called to safely clean up Application if Init has been called
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ //[InlineData (typeof (NetDriver))]
+ //[InlineData (typeof (CursesDriver))]
+ //[InlineData (typeof (WindowsDriver))]
+ public void End_Cleans_Up (Type driverType)
+ {
+ var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+ driver.Init (() => { });
+
+ Console.ForegroundColor = ConsoleColor.Red;
+ Assert.Equal (ConsoleColor.Red, Console.ForegroundColor);
+
+ Console.BackgroundColor = ConsoleColor.Green;
+ Assert.Equal (ConsoleColor.Green, Console.BackgroundColor);
+ driver.Move (2, 3);
+ Assert.Equal (2, Console.CursorLeft);
+ Assert.Equal (3, Console.CursorTop);
+
+ driver.End ();
+ Assert.Equal (0, Console.CursorLeft);
+ Assert.Equal (0, Console.CursorTop);
+ Assert.Equal (ConsoleColor.Gray, Console.ForegroundColor);
+ Assert.Equal (ConsoleColor.Black, Console.BackgroundColor);
+
+ // Shutdown must be called to safely clean up Application if Init has been called
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void FakeDriver_Only_Sends_Keystrokes_Through_MockKeyPresses (Type driverType)
+ {
+ var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ var top = Application.Top;
+ var view = new View ();
+ var count = 0;
+ var wasKeyPressed = false;
+
+ view.KeyPress += (s, e) => {
+ wasKeyPressed = true;
+ };
+ top.Add (view);
+
+ Application.Iteration += () => {
+ count++;
+ if (count == 10) Application.RequestStop ();
+ };
+
+ Application.Run ();
+
+ Assert.False (wasKeyPressed);
+
+ // Shutdown must be called to safely clean up Application if Init has been called
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void FakeDriver_MockKeyPresses (Type driverType)
+ {
+ var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ var text = "MockKeyPresses";
+ var mKeys = new Stack ();
+ foreach (var r in text.Reverse ()) {
+ var ck = char.IsLetter (r) ? (ConsoleKey)char.ToUpper (r) : (ConsoleKey)r;
+ var cki = new ConsoleKeyInfo (r, ck, false, false, false);
+ mKeys.Push (cki);
+ }
+ Console.MockKeyPresses = mKeys;
+
+ var top = Application.Top;
+ var view = new View ();
+ var rText = "";
+ var idx = 0;
+
+ view.KeyPress += (s, e) => {
+ Assert.Equal (text [idx], (char)e.KeyEvent.Key);
+ rText += (char)e.KeyEvent.Key;
+ Assert.Equal (rText, text.Substring (0, idx + 1));
+ e.Handled = true;
+ idx++;
+ };
+ top.Add (view);
+
+ Application.Iteration += () => {
+ if (mKeys.Count == 0) Application.RequestStop ();
+ };
+
+ Application.Run ();
+
+ Assert.Equal ("MockKeyPresses", rText);
+
+ // Shutdown must be called to safely clean up Application if Init has been called
+ Application.Shutdown ();
+ }
+
+ //[Theory]
+ //[InlineData (typeof (FakeDriver))]
+ //public void FakeDriver_MockKeyPresses_Press_AfterTimeOut (Type driverType)
+ //{
+ // var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
+ // Application.Init (driver);
+
+ // // Simulating pressing of QuitKey after a short period of time
+ // uint quitTime = 100;
+ // Func closeCallback = (MainLoop loop) => {
+ // // Prove the scenario is using Application.QuitKey correctly
+ // output.WriteLine ($" {quitTime}ms elapsed; Simulating keypresses...");
+ // FakeConsole.PushMockKeyPress (Key.F);
+ // FakeConsole.PushMockKeyPress (Key.U);
+ // FakeConsole.PushMockKeyPress (Key.C);
+ // FakeConsole.PushMockKeyPress (Key.K);
+ // return false;
+ // };
+ // output.WriteLine ($"Add timeout to simulate key presses after {quitTime}ms");
+ // _ = Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (quitTime), closeCallback);
+
+ // // If Top doesn't quit within abortTime * 5 (500ms), this will force it
+ // uint abortTime = quitTime * 5;
+ // Func forceCloseCallback = (MainLoop loop) => {
+ // Application.RequestStop ();
+ // Assert.Fail ($" failed to Quit after {abortTime}ms. Force quit.");
+ // return false;
+ // };
+ // output.WriteLine ($"Add timeout to force quit after {abortTime}ms");
+ // _ = Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (abortTime), forceCloseCallback);
+
+
+ // Key key = Key.Unknown;
+
+ // Application.Top.KeyPress += (e) => {
+ // key = e.KeyEvent.Key;
+ // output.WriteLine ($" Application.Top.KeyPress: {key}");
+ // e.Handled = true;
+
+ // };
+
+ // int iterations = 0;
+ // Application.Iteration += () => {
+ // output.WriteLine ($" iteration {++iterations}");
+
+ // if (Console.MockKeyPresses.Count == 0) {
+ // output.WriteLine ($" No more MockKeyPresses; RequestStop");
+ // Application.RequestStop ();
+ // }
+ // };
+
+ // Application.Run ();
+
+ // // Shutdown must be called to safely clean up Application if Init has been called
+ // Application.Shutdown ();
+ //}
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void TerminalResized_Simulation (Type driverType)
+ {
+ var driver = (FakeDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+ var wasTerminalResized = false;
+ Application.Resized = (e) => {
+ wasTerminalResized = true;
+ Assert.Equal (120, e.Cols);
+ Assert.Equal (40, e.Rows);
+ };
+
+ Assert.Equal (80, Console.BufferWidth);
+ Assert.Equal (25, Console.BufferHeight);
+
+ // MockDriver is by default 80x25
+ Assert.Equal (Console.BufferWidth, driver.Cols);
+ Assert.Equal (Console.BufferHeight, driver.Rows);
+ Assert.False (wasTerminalResized);
+
+ // MockDriver will now be sets to 120x40
+ driver.SetBufferSize (120, 40);
+ Assert.Equal (120, Application.Driver.Cols);
+ Assert.Equal (40, Application.Driver.Rows);
+ Assert.True (wasTerminalResized);
+
+ // MockDriver will still be 120x40
+ wasTerminalResized = false;
+ Application.EnableConsoleScrolling = true;
+ driver.SetWindowSize (40, 20);
+ Assert.Equal (120, Application.Driver.Cols);
+ Assert.Equal (40, Application.Driver.Rows);
+ Assert.Equal (120, Console.BufferWidth);
+ Assert.Equal (40, Console.BufferHeight);
+ Assert.Equal (40, Console.WindowWidth);
+ Assert.Equal (20, Console.WindowHeight);
+ Assert.True (wasTerminalResized);
+
+ Application.Shutdown ();
+ }
+
+ [Fact, AutoInitShutdown]
+ public void Write_Do_Not_Change_On_ProcessKey ()
+ {
+ var win = new Window ();
+ Application.Begin (win);
+ ((FakeDriver)Application.Driver).SetBufferSize (20, 8);
+
+ System.Threading.Tasks.Task.Run (() => {
+ System.Threading.Tasks.Task.Delay (500).Wait ();
+ Application.MainLoop.Invoke (() => {
+ var lbl = new Label ("Hello World") { X = Pos.Center () };
+ var dlg = new Dialog ("Test", new Button ("Ok"));
+ dlg.Add (lbl);
+ Application.Begin (dlg);
+
+ var expected = @"
+┌──────────────────┐
+│┌┤Test├─────────┐ │
+││ Hello World │ │
+││ │ │
+││ │ │
+││ [ Ok ] │ │
+│└───────────────┘ │
+└──────────────────┘
+";
+
+ var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+ Assert.Equal (new Rect (0, 0, 20, 8), pos);
+
+ Assert.True (dlg.ProcessKey (new KeyEvent (Key.Tab, new KeyModifiers ())));
+ dlg.Redraw (dlg.Bounds);
+
+ expected = @"
+┌──────────────────┐
+│┌┤Test├─────────┐ │
+││ Hello World │ │
+││ │ │
+││ │ │
+││ [ Ok ] │ │
+│└───────────────┘ │
+└──────────────────┘
+";
+
+ pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+ Assert.Equal (new Rect (0, 0, 20, 8), pos);
+
+ win.RequestStop ();
+ });
+ });
+
+ Application.Run (win);
+ Application.Shutdown ();
+ }
+ }
+}
diff --git a/UnitTests/ConsoleDrivers/ConsoleScrolllingTests.cs b/UnitTests/ConsoleDrivers/ConsoleScrolllingTests.cs
new file mode 100644
index 000000000..28eeae454
--- /dev/null
+++ b/UnitTests/ConsoleDrivers/ConsoleScrolllingTests.cs
@@ -0,0 +1,157 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Xunit;
+using Xunit.Abstractions;
+
+// Alias Console to MockConsole so we don't accidentally use Console
+using Console = Terminal.Gui.FakeConsole;
+
+namespace Terminal.Gui.DriverTests {
+ public class ConsoleScrollingTests {
+ readonly ITestOutputHelper output;
+
+ public ConsoleScrollingTests (ITestOutputHelper output)
+ {
+ this.output = output;
+ }
+
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void EnableConsoleScrolling_Is_False_Left_And_Top_Is_Always_Zero (Type driverType)
+ {
+ var driver = (FakeDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ Assert.False (Application.EnableConsoleScrolling);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ driver.SetWindowPosition (5, 5);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void EnableConsoleScrolling_Is_True_Left_Cannot_Be_Greater_Than_WindowWidth (Type driverType)
+ {
+ var driver = (FakeDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ Application.EnableConsoleScrolling = true;
+ Assert.True (Application.EnableConsoleScrolling);
+
+ driver.SetWindowPosition (81, 25);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void EnableConsoleScrolling_Is_True_Left_Cannot_Be_Greater_Than_BufferWidth_Minus_WindowWidth (Type driverType)
+ {
+ var driver = (FakeDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ Application.EnableConsoleScrolling = true;
+ Assert.True (Application.EnableConsoleScrolling);
+
+ driver.SetWindowPosition (81, 25);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ // MockDriver will now be sets to 120x25
+ driver.SetBufferSize (120, 25);
+ Assert.Equal (120, Application.Driver.Cols);
+ Assert.Equal (25, Application.Driver.Rows);
+ Assert.Equal (120, Console.BufferWidth);
+ Assert.Equal (25, Console.BufferHeight);
+ Assert.Equal (80, Console.WindowWidth);
+ Assert.Equal (25, Console.WindowHeight);
+ driver.SetWindowPosition (121, 25);
+ Assert.Equal (40, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ driver.SetWindowSize (90, 25);
+ Assert.Equal (120, Application.Driver.Cols);
+ Assert.Equal (25, Application.Driver.Rows);
+ Assert.Equal (120, Console.BufferWidth);
+ Assert.Equal (25, Console.BufferHeight);
+ Assert.Equal (90, Console.WindowWidth);
+ Assert.Equal (25, Console.WindowHeight);
+ driver.SetWindowPosition (121, 25);
+ Assert.Equal (30, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void EnableConsoleScrolling_Is_True_Top_Cannot_Be_Greater_Than_WindowHeight (Type driverType)
+ {
+ var driver = (FakeDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ Application.EnableConsoleScrolling = true;
+ Assert.True (Application.EnableConsoleScrolling);
+
+ driver.SetWindowPosition (80, 26);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ Application.Shutdown ();
+ }
+
+ [Theory]
+ [InlineData (typeof (FakeDriver))]
+ public void EnableConsoleScrolling_Is_True_Top_Cannot_Be_Greater_Than_BufferHeight_Minus_WindowHeight (Type driverType)
+ {
+ var driver = (FakeDriver)Activator.CreateInstance (driverType);
+ Application.Init (driver);
+
+ Application.EnableConsoleScrolling = true;
+ Assert.True (Application.EnableConsoleScrolling);
+
+ driver.SetWindowPosition (80, 26);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+
+ // MockDriver will now be sets to 80x40
+ driver.SetBufferSize (80, 40);
+ Assert.Equal (80, Application.Driver.Cols);
+ Assert.Equal (40, Application.Driver.Rows);
+ Assert.Equal (80, Console.BufferWidth);
+ Assert.Equal (40, Console.BufferHeight);
+ Assert.Equal (80, Console.WindowWidth);
+ Assert.Equal (25, Console.WindowHeight);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (0, Console.WindowTop);
+ driver.SetWindowPosition (80, 40);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (15, Console.WindowTop);
+
+ driver.SetWindowSize (80, 20);
+ Assert.Equal (80, Application.Driver.Cols);
+ Assert.Equal (40, Application.Driver.Rows);
+ Assert.Equal (80, Console.BufferWidth);
+ Assert.Equal (40, Console.BufferHeight);
+ Assert.Equal (80, Console.WindowWidth);
+ Assert.Equal (20, Console.WindowHeight);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (15, Console.WindowTop);
+ driver.SetWindowPosition (80, 41);
+ Assert.Equal (0, Console.WindowLeft);
+ Assert.Equal (20, Console.WindowTop);
+
+ Application.Shutdown ();
+ }
+ }
+}
diff --git a/UnitTests/ConsoleDrivers/KeyTests.cs b/UnitTests/ConsoleDrivers/KeyTests.cs
new file mode 100644
index 000000000..f480c2417
--- /dev/null
+++ b/UnitTests/ConsoleDrivers/KeyTests.cs
@@ -0,0 +1,349 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Terminal.Gui;
+using Xunit;
+
+namespace Terminal.Gui.InputTests {
+ public class KeyTests {
+ enum SimpleEnum { Zero, One, Two, Three, Four, Five }
+
+ [Flags]
+ enum FlaggedEnum { Zero, One, Two, Three, Four, Five }
+
+
+ enum SimpleHighValueEnum { Zero, One, Two, Three, Four, Last = 0x40000000 }
+
+ [Flags]
+ enum FlaggedHighValueEnum { Zero, One, Two, Three, Four, Last = 0x40000000 }
+
+ [Fact]
+ public void SimpleEnum_And_FlagedEnum ()
+ {
+ var simple = SimpleEnum.Three | SimpleEnum.Five;
+
+ // Nothing will not be well compared here.
+ Assert.True (simple.HasFlag (SimpleEnum.Zero | SimpleEnum.Five));
+ Assert.True (simple.HasFlag (SimpleEnum.One | SimpleEnum.Five));
+ Assert.True (simple.HasFlag (SimpleEnum.Two | SimpleEnum.Five));
+ Assert.True (simple.HasFlag (SimpleEnum.Three | SimpleEnum.Five));
+ Assert.True (simple.HasFlag (SimpleEnum.Four | SimpleEnum.Five));
+ Assert.True ((simple & (SimpleEnum.Zero | SimpleEnum.Five)) != 0);
+ Assert.True ((simple & (SimpleEnum.One | SimpleEnum.Five)) != 0);
+ Assert.True ((simple & (SimpleEnum.Two | SimpleEnum.Five)) != 0);
+ Assert.True ((simple & (SimpleEnum.Three | SimpleEnum.Five)) != 0);
+ Assert.True ((simple & (SimpleEnum.Four | SimpleEnum.Five)) != 0);
+ Assert.Equal (7, (int)simple); // As it is not flagged only shows as number.
+ Assert.Equal ("7", simple.ToString ());
+ Assert.False (simple == (SimpleEnum.Zero | SimpleEnum.Five));
+ Assert.False (simple == (SimpleEnum.One | SimpleEnum.Five));
+ Assert.True (simple == (SimpleEnum.Two | SimpleEnum.Five));
+ Assert.True (simple == (SimpleEnum.Three | SimpleEnum.Five));
+ Assert.False (simple == (SimpleEnum.Four | SimpleEnum.Five));
+
+ var flagged = FlaggedEnum.Three | FlaggedEnum.Five;
+
+ // Nothing will not be well compared here.
+ Assert.True (flagged.HasFlag (FlaggedEnum.Zero | FlaggedEnum.Five));
+ Assert.True (flagged.HasFlag (FlaggedEnum.One | FlaggedEnum.Five));
+ Assert.True (flagged.HasFlag (FlaggedEnum.Two | FlaggedEnum.Five));
+ Assert.True (flagged.HasFlag (FlaggedEnum.Three | FlaggedEnum.Five));
+ Assert.True (flagged.HasFlag (FlaggedEnum.Four | FlaggedEnum.Five));
+ Assert.True ((flagged & (FlaggedEnum.Zero | FlaggedEnum.Five)) != 0);
+ Assert.True ((flagged & (FlaggedEnum.One | FlaggedEnum.Five)) != 0);
+ Assert.True ((flagged & (FlaggedEnum.Two | FlaggedEnum.Five)) != 0);
+ Assert.True ((flagged & (FlaggedEnum.Three | FlaggedEnum.Five)) != 0);
+ Assert.True ((flagged & (FlaggedEnum.Four | FlaggedEnum.Five)) != 0);
+ Assert.Equal (FlaggedEnum.Two | FlaggedEnum.Five, flagged); // As it is flagged shows as bitwise.
+ Assert.Equal ("Two, Five", flagged.ToString ());
+ Assert.False (flagged == (FlaggedEnum.Zero | FlaggedEnum.Five));
+ Assert.False (flagged == (FlaggedEnum.One | FlaggedEnum.Five));
+ Assert.True (flagged == (FlaggedEnum.Two | FlaggedEnum.Five));
+ Assert.True (flagged == (FlaggedEnum.Three | FlaggedEnum.Five));
+ Assert.False (flagged == (FlaggedEnum.Four | FlaggedEnum.Five));
+ }
+
+ [Fact]
+ public void SimpleHighValueEnum_And_FlaggedHighValueEnum ()
+ {
+ var simple = SimpleHighValueEnum.Three | SimpleHighValueEnum.Last;
+
+ // This will not be well compared.
+ Assert.True (simple.HasFlag (SimpleHighValueEnum.Zero | SimpleHighValueEnum.Last));
+ Assert.True (simple.HasFlag (SimpleHighValueEnum.One | SimpleHighValueEnum.Last));
+ Assert.True (simple.HasFlag (SimpleHighValueEnum.Two | SimpleHighValueEnum.Last));
+ Assert.True (simple.HasFlag (SimpleHighValueEnum.Three | SimpleHighValueEnum.Last));
+ Assert.False (simple.HasFlag (SimpleHighValueEnum.Four | SimpleHighValueEnum.Last));
+ Assert.True ((simple & (SimpleHighValueEnum.Zero | SimpleHighValueEnum.Last)) != 0);
+ Assert.True ((simple & (SimpleHighValueEnum.One | SimpleHighValueEnum.Last)) != 0);
+ Assert.True ((simple & (SimpleHighValueEnum.Two | SimpleHighValueEnum.Last)) != 0);
+ Assert.True ((simple & (SimpleHighValueEnum.Three | SimpleHighValueEnum.Last)) != 0);
+ Assert.True ((simple & (SimpleHighValueEnum.Four | SimpleHighValueEnum.Last)) != 0);
+
+ // This will be well compared, because the SimpleHighValueEnum.Last have a high value.
+ Assert.Equal (1073741827, (int)simple); // As it is not flagged only shows as number.
+ Assert.Equal ("1073741827", simple.ToString ()); // As it is not flagged only shows as number.
+ Assert.False (simple == (SimpleHighValueEnum.Zero | SimpleHighValueEnum.Last));
+ Assert.False (simple == (SimpleHighValueEnum.One | SimpleHighValueEnum.Last));
+ Assert.False (simple == (SimpleHighValueEnum.Two | SimpleHighValueEnum.Last));
+ Assert.True (simple == (SimpleHighValueEnum.Three | SimpleHighValueEnum.Last));
+ Assert.False (simple == (SimpleHighValueEnum.Four | SimpleHighValueEnum.Last));
+
+ var flagged = FlaggedHighValueEnum.Three | FlaggedHighValueEnum.Last;
+
+ // This will not be well compared.
+ Assert.True (flagged.HasFlag (FlaggedHighValueEnum.Zero | FlaggedHighValueEnum.Last));
+ Assert.True (flagged.HasFlag (FlaggedHighValueEnum.One | FlaggedHighValueEnum.Last));
+ Assert.True (flagged.HasFlag (FlaggedHighValueEnum.Two | FlaggedHighValueEnum.Last));
+ Assert.True (flagged.HasFlag (FlaggedHighValueEnum.Three | FlaggedHighValueEnum.Last));
+ Assert.False (flagged.HasFlag (FlaggedHighValueEnum.Four | FlaggedHighValueEnum.Last));
+ Assert.True ((flagged & (FlaggedHighValueEnum.Zero | FlaggedHighValueEnum.Last)) != 0);
+ Assert.True ((flagged & (FlaggedHighValueEnum.One | FlaggedHighValueEnum.Last)) != 0);
+ Assert.True ((flagged & (FlaggedHighValueEnum.Two | FlaggedHighValueEnum.Last)) != 0);
+ Assert.True ((flagged & (FlaggedHighValueEnum.Three | FlaggedHighValueEnum.Last)) != 0);
+ Assert.True ((flagged & (FlaggedHighValueEnum.Four | FlaggedHighValueEnum.Last)) != 0);
+
+ // This will be well compared, because the SimpleHighValueEnum.Last have a high value.
+ Assert.Equal (FlaggedHighValueEnum.Three | FlaggedHighValueEnum.Last, flagged); // As it is flagged shows as bitwise.
+ Assert.Equal ("Three, Last", flagged.ToString ()); // As it is flagged shows as bitwise.
+ Assert.False (flagged == (FlaggedHighValueEnum.Zero | FlaggedHighValueEnum.Last));
+ Assert.False (flagged == (FlaggedHighValueEnum.One | FlaggedHighValueEnum.Last));
+ Assert.False (flagged == (FlaggedHighValueEnum.Two | FlaggedHighValueEnum.Last));
+ Assert.True (flagged == (FlaggedHighValueEnum.Three | FlaggedHighValueEnum.Last));
+ Assert.False (flagged == (FlaggedHighValueEnum.Four | FlaggedHighValueEnum.Last));
+ }
+
+ [Fact]
+ public void Key_Enum_Ambiguity_Check ()
+ {
+ var key = Key.Y | Key.CtrlMask;
+
+ // This will not be well compared.
+ Assert.True (key.HasFlag (Key.Q | Key.CtrlMask));
+ Assert.True ((key & (Key.Q | Key.CtrlMask)) != 0);
+ Assert.Equal (Key.Y | Key.CtrlMask, key);
+ Assert.Equal ("Y, CtrlMask", key.ToString ());
+
+ // This will be well compared, because the Key.CtrlMask have a high value.
+ Assert.False (key == Application.QuitKey);
+ switch (key) {
+ case Key.Q | Key.CtrlMask:
+ // Never goes here.
+ break;
+ case Key.Y | Key.CtrlMask:
+ Assert.True (key == (Key.Y | Key.CtrlMask));
+ break;
+ default:
+ // Never goes here.
+ break;
+ }
+ }
+
+ [Fact]
+ public void Key_ToString ()
+ {
+ var k = Key.Y | Key.CtrlMask;
+ Assert.Equal ("Y, CtrlMask", k.ToString ());
+
+ k = Key.CtrlMask | Key.Y;
+ Assert.Equal ("Y, CtrlMask", k.ToString ());
+
+ k = Key.Space;
+ Assert.Equal ("Space", k.ToString ());
+
+ k = Key.Space | Key.D;
+ Assert.Equal ("d", k.ToString ());
+
+ k = (Key)'d';
+ Assert.Equal ("d", k.ToString ());
+
+ k = Key.d;
+ Assert.Equal ("d", k.ToString ());
+
+ k = Key.D;
+ Assert.Equal ("D", k.ToString ());
+
+ // In a console this will always returns Key.D
+ k = Key.D | Key.ShiftMask;
+ Assert.Equal ("D, ShiftMask", k.ToString ());
+
+ // In a console this will always returns Key.D
+ k = Key.d | Key.ShiftMask;
+ Assert.Equal ("d, ShiftMask", k.ToString ());
+ }
+
+
+ private static object packetLock = new object ();
+
+ ///
+ /// Sometimes when using remote tools EventKeyRecord sends 'virtual keystrokes'.
+ /// These are indicated with the wVirtualKeyCode of 231. When we see this code
+ /// then we need to look to the unicode character (UnicodeChar) instead of the key
+ /// when telling the rest of the framework what button was pressed. For full details
+ /// see: https://github.com/gui-cs/Terminal.Gui/issues/2008
+ ///
+ [Theory, AutoInitShutdown]
+ [ClassData (typeof (PacketTest))]
+ public void TestVKPacket (uint unicodeCharacter, bool shift, bool alt, bool control, uint initialVirtualKey, uint initialScanCode, Key expectedRemapping, uint expectedVirtualKey, uint expectedScanCode)
+ {
+ var modifiers = new ConsoleModifiers ();
+ if (shift) modifiers |= ConsoleModifiers.Shift;
+ if (alt) modifiers |= ConsoleModifiers.Alt;
+ if (control) modifiers |= ConsoleModifiers.Control;
+ var mappedConsoleKey = ConsoleKeyMapping.GetConsoleKeyFromKey (unicodeCharacter, modifiers, out uint scanCode, out uint outputChar);
+
+ if ((scanCode > 0 || mappedConsoleKey == 0) && mappedConsoleKey == initialVirtualKey) Assert.Equal (mappedConsoleKey, initialVirtualKey);
+ else Assert.Equal (mappedConsoleKey, outputChar < 0xff ? outputChar & 0xff | 0xff << 8 : outputChar);
+ Assert.Equal (scanCode, initialScanCode);
+
+ var keyChar = ConsoleKeyMapping.GetKeyCharFromConsoleKey (mappedConsoleKey, modifiers, out uint consoleKey, out scanCode);
+
+ //if (scanCode > 0 && consoleKey == keyChar && consoleKey > 48 && consoleKey > 57 && consoleKey < 65 && consoleKey > 91) {
+ if (scanCode > 0 && keyChar == 0 && consoleKey == mappedConsoleKey) Assert.Equal (0, (double)keyChar);
+ else Assert.Equal (keyChar, unicodeCharacter);
+ Assert.Equal (consoleKey, expectedVirtualKey);
+ Assert.Equal (scanCode, expectedScanCode);
+
+ var top = Application.Top;
+
+ top.KeyPress += (s, e) => {
+ var after = ShortcutHelper.GetModifiersKey (e.KeyEvent);
+ Assert.Equal (expectedRemapping, after);
+ e.Handled = true;
+ Application.RequestStop ();
+ };
+
+ var iterations = -1;
+
+ Application.Iteration += () => {
+ iterations++;
+ if (iterations == 0) Application.Driver.SendKeys ((char)mappedConsoleKey, ConsoleKey.Packet, shift, alt, control);
+ };
+
+
+ lock (packetLock) {
+ Application.Run ();
+ Application.Shutdown ();
+ }
+ }
+
+ public class PacketTest : IEnumerable, IEnumerable