using System;
namespace Spectre.Console
{
///
/// Contains extension methods for .
///
public static partial class AnsiConsoleExtensions
{
///
/// Switches to an alternate screen buffer if the terminal supports it.
///
/// The console.
/// The action to execute within the alternate screen buffer.
public static void AlternateScreen(this IAnsiConsole console, Action action)
{
if (console is null)
{
throw new ArgumentNullException(nameof(console));
}
if (!console.Profile.Capabilities.Ansi)
{
throw new NotSupportedException("Alternate buffers are not supported since your terminal does not support ANSI.");
}
if (!console.Profile.Capabilities.AlternateBuffer)
{
throw new NotSupportedException("Alternate buffers are not supported by your terminal.");
}
console.ExclusivityMode.Run