Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_develop

This commit is contained in:
Tig
2025-02-27 10:45:43 -07:00
9 changed files with 83 additions and 71 deletions

View File

@@ -532,8 +532,8 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverHorizontal,
IntersectionType.PassOverVertical
[IntersectionType.PassOverHorizontal,
IntersectionType.PassOverVertical]
))
{
return IntersectionRuneType.Cross;
@@ -541,9 +541,9 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverVertical,
[IntersectionType.PassOverVertical,
IntersectionType.StartLeft,
IntersectionType.StartRight
IntersectionType.StartRight]
))
{
return IntersectionRuneType.Cross;
@@ -551,9 +551,9 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverHorizontal,
[IntersectionType.PassOverHorizontal,
IntersectionType.StartUp,
IntersectionType.StartDown
IntersectionType.StartDown]
))
{
return IntersectionRuneType.Cross;
@@ -561,10 +561,10 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.StartLeft,
[IntersectionType.StartLeft,
IntersectionType.StartRight,
IntersectionType.StartUp,
IntersectionType.StartDown
IntersectionType.StartDown]
))
{
return IntersectionRuneType.Cross;
@@ -574,38 +574,22 @@ public class LineCanvas : IDisposable
#region Corner Conditions
if (Exactly (
set,
IntersectionType.StartRight,
IntersectionType.StartDown
))
if (Exactly (set, CornerIntersections.UpperLeft))
{
return IntersectionRuneType.ULCorner;
}
if (Exactly (
set,
IntersectionType.StartLeft,
IntersectionType.StartDown
))
if (Exactly (set, CornerIntersections.UpperRight))
{
return IntersectionRuneType.URCorner;
}
if (Exactly (
set,
IntersectionType.StartUp,
IntersectionType.StartLeft
))
if (Exactly (set, CornerIntersections.LowerRight))
{
return IntersectionRuneType.LRCorner;
}
if (Exactly (
set,
IntersectionType.StartUp,
IntersectionType.StartRight
))
if (Exactly (set, CornerIntersections.LowerLeft))
{
return IntersectionRuneType.LLCorner;
}
@@ -616,8 +600,8 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverHorizontal,
IntersectionType.StartDown
[IntersectionType.PassOverHorizontal,
IntersectionType.StartDown]
))
{
return IntersectionRuneType.TopTee;
@@ -625,9 +609,9 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.StartRight,
[IntersectionType.StartRight,
IntersectionType.StartLeft,
IntersectionType.StartDown
IntersectionType.StartDown]
))
{
return IntersectionRuneType.TopTee;
@@ -635,8 +619,8 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverHorizontal,
IntersectionType.StartUp
[IntersectionType.PassOverHorizontal,
IntersectionType.StartUp]
))
{
return IntersectionRuneType.BottomTee;
@@ -644,9 +628,9 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.StartRight,
[IntersectionType.StartRight,
IntersectionType.StartLeft,
IntersectionType.StartUp
IntersectionType.StartUp]
))
{
return IntersectionRuneType.BottomTee;
@@ -654,8 +638,8 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverVertical,
IntersectionType.StartRight
[IntersectionType.PassOverVertical,
IntersectionType.StartRight]
))
{
return IntersectionRuneType.LeftTee;
@@ -663,9 +647,9 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.StartRight,
[IntersectionType.StartRight,
IntersectionType.StartDown,
IntersectionType.StartUp
IntersectionType.StartUp]
))
{
return IntersectionRuneType.LeftTee;
@@ -673,8 +657,8 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.PassOverVertical,
IntersectionType.StartLeft
[IntersectionType.PassOverVertical,
IntersectionType.StartLeft]
))
{
return IntersectionRuneType.RightTee;
@@ -682,9 +666,9 @@ public class LineCanvas : IDisposable
if (Has (
set,
IntersectionType.StartLeft,
[IntersectionType.StartLeft,
IntersectionType.StartDown,
IntersectionType.StartUp
IntersectionType.StartUp]
))
{
return IntersectionRuneType.RightTee;
@@ -712,7 +696,7 @@ public class LineCanvas : IDisposable
/// <param name="intersects"></param>
/// <param name="types"></param>
/// <returns></returns>
private bool Has (HashSet<IntersectionType> intersects, params IntersectionType [] types)
private bool Has (HashSet<IntersectionType> intersects, ReadOnlySpan<IntersectionType> types)
{
foreach (var type in types)
{
@@ -724,6 +708,25 @@ public class LineCanvas : IDisposable
return true;
}
/// <summary>
/// Preallocated arrays for <see cref="GetRuneTypeForIntersects"/> calls to <see cref="Exactly"/>.
/// </summary>
/// <remarks>
/// Optimization to avoid array allocation for each call from array params. Please do not edit the arrays at runtime. :)
///
/// More ideal solution would be to change <see cref="Exactly"/> to take ReadOnlySpan instead of an array
/// but that would require replacing the HashSet.SetEquals call.
/// </remarks>
private static class CornerIntersections
{
// Names matching #region "Corner Conditions" IntersectionRuneType
internal static readonly IntersectionType[] UpperLeft = [IntersectionType.StartRight, IntersectionType.StartDown];
internal static readonly IntersectionType[] UpperRight = [IntersectionType.StartLeft, IntersectionType.StartDown];
internal static readonly IntersectionType[] LowerRight = [IntersectionType.StartUp, IntersectionType.StartLeft];
internal static readonly IntersectionType[] LowerLeft = [IntersectionType.StartUp, IntersectionType.StartRight];
}
private class BottomTeeIntersectionRuneResolver : IntersectionRuneResolver
{
public override void SetGlyphs ()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 107 KiB

View File

@@ -11,7 +11,7 @@
* **[Extensible UI](https://gui-cs.github.io/Terminal.GuiV2Docs/api/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. Dozens of [Built-in Views](views.md) are provided.
* **[Keyboard](keyboard.md) and [Mouse](mouse.md) Input** - The library handles all the details of input processing and provides a simple event-based API for applications to consume.
* **[Powerful Layout Engine](layout.md)** - The layout engine makes it easy to lay out controls relative to each other and enables dynamic terminal UIs.
* **[Machine, User, and App-Level Configuration](config.md)** - Persistent configuration settings, including overriding default look & feel with Themes, keyboard bindings, and more via the [`ConfigurationManager`](~/api/Terminal.Gui.ConfigurationManager.yml) class.
* **[Machine, User, and App-Level Configuration](config.md)** - Persistent configuration settings, including overriding default look & feel with Themes, keyboard bindings, and more via the [ConfigurationManager](~/api/Terminal.Gui.ConfigurationManager.yml) class.
* **[Clipboard support](https://gui-cs.github.io/Terminal.GuiV2Docs/api/Terminal.Gui.Clipboard.html)** - Cut, Copy, and Paste is provided through the [`Clipboard`] class.
* **Multi-tasking** - The [Mainloop](https://gui-cs.github.io/Terminal.GuiV2Docs/api/Terminal.Gui.MainLoop.html) supports processing events, idle handlers, and timers. Most classes are safe for threading.
* **[Reactive Extensions](https://github.com/dotnet/reactive)** - Use reactive extensions 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.GuiV2Docs/tree/master/ReactiveExample) of a sample app.
@@ -20,17 +20,22 @@ See [What's New in V2 For more](newinv2.md).
## Conceptual Documentation
* [Guide to Migrating from Terminal.Gui v1](migratingfromv1.md)
* [List of Views](views.md)
* [Layout Engine](layout.md)
* [Navigation](navigation.md)
* [Keyboard API](keyboard.md)
* [Mouse API](mouse.md)
* [Arrangement API](arrangement.md)
* [Configuration and Theme Manager](config.md)
* [Multi-tasking and the Application Main Loop](mainloop.md)
* [Cursor Deep Dive](cursor.md)
* [Cross-platform Driver Model](drivers.md)
* [Dim.Auto Deep Dive](dimauto.md)
* [Drawing](drawing.md)
* [Events Deep Dive](events.md)
* [Keyboard API](keyboard.md)
* [Layout Engine](layout.md)
* [Migrating from Terminal.Gui v1](migratingfromv1.md)
* [Mouse API](mouse.md)
* [Multi-tasking and the Application Main Loop](mainloop.md)
* [Navigation](navigation.md)
* [View Deep Dive](View.md)
* [Views](views.md)
* [Scrolling Deep Dive](scrolling.md)
* [TableView Deep Dive](tableview.md)
* [TreeView Deep Dive](treeview.md)

View File

@@ -6,32 +6,36 @@
href: newinv2.md
- name: v1 To v2 Migration
href: migratingfromv1.md
- name: View Deep Dive
href: View.md
- name: List of Views
href: views.md
- name: Layout Engine
href: layout.md
- name: Arrangement
href: arrangement.md
- name: Navigation
href: navigation.md
- name: Scrolling
href: scrolling.md
- name: Keyboard
href: keyboard.md
- name: Mouse
href: mouse.md
- name: Configuration
href: config.md
- name: Cursor
href: cursor.md
- name: Dim.Auto Deep Dive
href: dimauto.md
- name: Drawing
href: drawing.md
- name: Drivers
href: drivers.md
- name: Events Deep Dive
href: events.md
- name: Keyboard
href: keyboard.md
- name: Layout Engine
href: layout.md
- name: Mouse
href: mouse.md
- name: Multi-Tasking
href: mainloop.md
- name: Dim.Auto Deep Dive
href: dimauto.md
- name: Navigation
href: navigation.md
- name: View Deep Dive
href: View.md
- name: View List
href: views.md
- name: Scrolling
href: scrolling.md
- name: TableView Deep Dive
href: tableview.md
- name: TreeView Deep Dive

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

After

Width:  |  Height:  |  Size: 185 KiB

View File

@@ -8,7 +8,7 @@ A toolkit for building rich console apps for .NET that run on Windows, the Mac,
## Terminal.Gui API Documentation
* [Conceptual Documentation](docs/index.md)
* [Conceptual Docs & Deep Dives](docs/index.md)
* [API Reference](~/api/Terminal.Gui.yml)
## UI Catalog

View File

@@ -1,4 +1,4 @@
- name: Conceptual Docs
- name: Conceptual Docs & Deep Dives
href: docs/
- name: API