From 255e5d6643271b79cfb5e91cd79d6e4d5806178a Mon Sep 17 00:00:00 2001 From: Thomas Nind <31306100+tznind@users.noreply.github.com> Date: Sun, 2 Mar 2025 00:22:55 +0000 Subject: [PATCH] Fix driver name options shown in UICatalog for v2 (#3940) - v2 auto picks based on OS - v2win is the new windows interop driver - v2net is the new dotnet core cross platform driver Co-authored-by: Tig --- Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs | 6 +++--- UICatalog/UICatalog.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs b/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs index aae6c855d..700caf72c 100644 --- a/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs +++ b/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs @@ -231,14 +231,14 @@ internal class ConsoleDriverFacade : IConsoleDriver, IConsoleDriverFacade if (InputProcessor is WindowsInputProcessor) { - type = "(win)"; + type = "win"; } else if (InputProcessor is NetInputProcessor) { - type = "(net)"; + type = "net"; } - return GetType ().Name.TrimEnd ('`', '1') + type; + return "v2" + type; } /// Tests if the specified rune is supported by the driver. diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index f0c13ad12..3ff3035dd 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -147,8 +147,10 @@ public class UICatalogApp // If no driver is provided, the default driver is used. Option driverOption = new Option ("--driver", "The IConsoleDriver to use.").FromAmong ( Application.GetDriverTypes () - .Select (d => d!.Name) - .ToArray () + .Where (d=>!typeof (IConsoleDriverFacade).IsAssignableFrom (d)) + .Select (d => d!.Name) + .Union (["v2","v2win","v2net"]) + .ToArray () ); driverOption.AddAlias ("-d"); driverOption.AddAlias ("--d");