diff --git a/Terminal.Gui/ConsoleDrivers/NetDriver.cs b/Terminal.Gui/ConsoleDrivers/NetDriver.cs index e2a9ff9d8..b5729406c 100644 --- a/Terminal.Gui/ConsoleDrivers/NetDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/NetDriver.cs @@ -1024,12 +1024,15 @@ internal class NetDriver : ConsoleDriver Console.Write (output); } - foreach (var s in Application.Sixel) + if (ConsoleDriver.SupportsSixel) { - if (!string.IsNullOrWhiteSpace (s.SixelData)) + foreach (var s in Application.Sixel) { - SetCursorPosition (s.ScreenPosition.X, s.ScreenPosition.Y); - Console.Write (s.SixelData); + if (!string.IsNullOrWhiteSpace (s.SixelData)) + { + SetCursorPosition (s.ScreenPosition.X, s.ScreenPosition.Y); + Console.Write (s.SixelData); + } } } } diff --git a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs index c476ae95e..aff9a57c8 100644 --- a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs @@ -127,11 +127,14 @@ internal class WindowsConsole _lastWrite = s; - foreach (var sixel in Application.Sixel) + if (ConsoleDriver.SupportsSixel) { - SetCursorPosition (new Coord ((short)sixel.ScreenPosition.X, (short)sixel.ScreenPosition.Y)); - WriteConsole (_screenBuffer, sixel.SixelData, (uint)sixel.SixelData.Length, out uint _, nint.Zero); + 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); + } } } diff --git a/UICatalog/Scenarios/Images.cs b/UICatalog/Scenarios/Images.cs index 3b275cb56..16c350c24 100644 --- a/UICatalog/Scenarios/Images.cs +++ b/UICatalog/Scenarios/Images.cs @@ -62,10 +62,13 @@ public class Images : Scenario Y = 1, CheckedState = ConsoleDriver.SupportsSixel ? CheckState.Checked : CheckState.UnChecked, - CanFocus = false, - Enabled = false, Text = "Supports Sixel" }; + + cbSupportsSixel.CheckedStateChanging += (s, e) => + { + ConsoleDriver.SupportsSixel = e.NewValue == CheckState.Checked; + }; _win.Add (cbSupportsSixel); var cbUseTrueColor = new CheckBox