浏览代码

Remove ConsoleDriver.SupportsSixel

tznind 9 月之前
父节点
当前提交
64d286c9b4

+ 0 - 3
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -484,9 +484,6 @@ public abstract class ConsoleDriver
     /// <summary>Gets whether the <see cref="ConsoleDriver"/> supports TrueColor output.</summary>
     /// <summary>Gets whether the <see cref="ConsoleDriver"/> supports TrueColor output.</summary>
     public virtual bool SupportsTrueColor => true;
     public virtual bool SupportsTrueColor => true;
 
 
-    // TODO: make not static TODO: gets set in mouse logic in net driver :/
-    public static bool SupportsSixel { get; set; }
-
     // TODO: This makes ConsoleDriver dependent on Application, which is not ideal. This should be moved to Application.
     // TODO: This makes ConsoleDriver dependent on Application, which is not ideal. This should be moved to Application.
     // BUGBUG: Application.Force16Colors should be bool? so if SupportsTrueColor and Application.Force16Colors == false, this doesn't override
     // BUGBUG: Application.Force16Colors should be bool? so if SupportsTrueColor and Application.Force16Colors == false, this doesn't override
     /// <summary>
     /// <summary>

+ 4 - 13
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -632,9 +632,6 @@ internal class NetEvents : IDisposable
                         break;
                         break;
                 }
                 }
 
 
-                break;
-            case EscSeqUtils.CSI_ReportDeviceAttributes_Terminator:
-                ConsoleDriver.SupportsSixel = values.Any (v => v == "4");
                 break;
                 break;
             default:
             default:
                 EnqueueRequestResponseEvent (c1Control, code, values, terminating);
                 EnqueueRequestResponseEvent (c1Control, code, values, terminating);
@@ -1024,15 +1021,12 @@ internal class NetDriver : ConsoleDriver
                 Console.Write (output);
                 Console.Write (output);
             }
             }
 
 
-            if (ConsoleDriver.SupportsSixel)
+            foreach (var s in Application.Sixel)
             {
             {
-                foreach (var s in Application.Sixel)
+                if (!string.IsNullOrWhiteSpace (s.SixelData))
                 {
                 {
-                    if (!string.IsNullOrWhiteSpace (s.SixelData))
-                    {
-                        SetCursorPosition (s.ScreenPosition.X, s.ScreenPosition.Y);
-                        Console.Write (s.SixelData);
-                    }
+                    SetCursorPosition (s.ScreenPosition.X, s.ScreenPosition.Y);
+                    Console.Write (s.SixelData);
                 }
                 }
             }
             }
         }
         }
@@ -1141,9 +1135,6 @@ internal class NetDriver : ConsoleDriver
         _mainLoopDriver = new NetMainLoop (this);
         _mainLoopDriver = new NetMainLoop (this);
         _mainLoopDriver.ProcessInput = ProcessInput;
         _mainLoopDriver.ProcessInput = ProcessInput;
 
 
-        _mainLoopDriver._netEvents.EscSeqRequests.Add ("c");
-        // Determine if sixel is supported
-        Console.Out.Write (EscSeqUtils.CSI_SendDeviceAttributes);
 
 
         return new MainLoop (_mainLoopDriver);
         return new MainLoop (_mainLoopDriver);
     }
     }

+ 3 - 7
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -129,14 +129,10 @@ internal class WindowsConsole
 
 
             _lastWrite = s;
             _lastWrite = s;
 
 
-            if (ConsoleDriver.SupportsSixel)
+            foreach (var sixel in Application.Sixel)
             {
             {
-                foreach (var sixel in Application.Sixel)
-                {
-                    SetCursorPosition (new Coord ((short)sixel.ScreenPosition.X, (short)sixel.ScreenPosition.Y));
-                    WriteConsole (_screenBuffer, sixel.SixelData, (uint)sixel.SixelData.Length, out uint _, nint.Zero);
-
-                }
+                SetCursorPosition (new Coord ((short)sixel.ScreenPosition.X, (short)sixel.ScreenPosition.Y));
+                WriteConsole (_screenBuffer, sixel.SixelData, (uint)sixel.SixelData.Length, out uint _, nint.Zero);
             }
             }
         }
         }
 
 

+ 2 - 4
UICatalog/Scenarios/Images.cs

@@ -69,8 +69,6 @@ public class Images : Scenario
         var sixelSupportDetector = new AssumeSupportDetector ();
         var sixelSupportDetector = new AssumeSupportDetector ();
         _sixelSupportResult = sixelSupportDetector.Detect ();
         _sixelSupportResult = sixelSupportDetector.Detect ();
 
 
-        ConsoleDriver.SupportsSixel = _sixelSupportResult.IsSupported;
-
         Application.Init ();
         Application.Init ();
         _win = new() { Title = $"{Application.QuitKey} to Quit - Scenario: {GetName ()}" };
         _win = new() { Title = $"{Application.QuitKey} to Quit - Scenario: {GetName ()}" };
 
 
@@ -103,7 +101,7 @@ public class Images : Scenario
         {
         {
             X = Pos.Right (lblDriverName) + 2,
             X = Pos.Right (lblDriverName) + 2,
             Y = 1,
             Y = 1,
-            CheckedState = ConsoleDriver.SupportsSixel
+            CheckedState = _sixelSupportResult.IsSupported
                                ? CheckState.Checked
                                ? CheckState.Checked
                                : CheckState.UnChecked,
                                : CheckState.UnChecked,
             Text = "Supports Sixel"
             Text = "Supports Sixel"
@@ -111,7 +109,7 @@ public class Images : Scenario
 
 
         cbSupportsSixel.CheckedStateChanging += (s, e) =>
         cbSupportsSixel.CheckedStateChanging += (s, e) =>
                                                 {
                                                 {
-                                                    ConsoleDriver.SupportsSixel = e.NewValue == CheckState.Checked;
+                                                    _sixelSupportResult.IsSupported = e.NewValue == CheckState.Checked;
                                                     SetupSixelSupported (e.NewValue == CheckState.Checked);
                                                     SetupSixelSupported (e.NewValue == CheckState.Checked);
                                                 };
                                                 };