mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Do not output sixel if driver does not support it
Allow overriding driver sixel support in Images scenario
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user