mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-20 05:48:14 +08:00
Use file scoped namespace declarations
This commit is contained in:

committed by
Phil Scott

parent
1dbaf50935
commit
ec1188b837
@ -1,62 +1,61 @@
|
||||
using System.Collections.Generic;
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace Spectre.Console
|
||||
namespace Spectre.Console;
|
||||
|
||||
internal sealed class LiveDisplayRenderer : IRenderHook
|
||||
{
|
||||
internal sealed class LiveDisplayRenderer : IRenderHook
|
||||
private readonly IAnsiConsole _console;
|
||||
private readonly LiveDisplayContext _context;
|
||||
|
||||
public LiveDisplayRenderer(IAnsiConsole console, LiveDisplayContext context)
|
||||
{
|
||||
private readonly IAnsiConsole _console;
|
||||
private readonly LiveDisplayContext _context;
|
||||
_console = console;
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public LiveDisplayRenderer(IAnsiConsole console, LiveDisplayContext context)
|
||||
{
|
||||
_console = console;
|
||||
_context = context;
|
||||
}
|
||||
public void Started()
|
||||
{
|
||||
_console.Cursor.Hide();
|
||||
}
|
||||
|
||||
public void Started()
|
||||
public void Completed(bool autoclear)
|
||||
{
|
||||
lock (_context.Lock)
|
||||
{
|
||||
_console.Cursor.Hide();
|
||||
}
|
||||
|
||||
public void Completed(bool autoclear)
|
||||
{
|
||||
lock (_context.Lock)
|
||||
if (autoclear)
|
||||
{
|
||||
if (autoclear)
|
||||
_console.Write(_context.Live.RestoreCursor());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_context.Live.HasRenderable && _context.Live.DidOverflow)
|
||||
{
|
||||
// Redraw the whole live renderable
|
||||
_console.Write(_context.Live.RestoreCursor());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_context.Live.HasRenderable && _context.Live.DidOverflow)
|
||||
{
|
||||
// Redraw the whole live renderable
|
||||
_console.Write(_context.Live.RestoreCursor());
|
||||
_context.Live.Overflow = VerticalOverflow.Visible;
|
||||
_console.Write(_context.Live.Target);
|
||||
}
|
||||
|
||||
_console.WriteLine();
|
||||
_context.Live.Overflow = VerticalOverflow.Visible;
|
||||
_console.Write(_context.Live.Target);
|
||||
}
|
||||
|
||||
_console.Cursor.Show();
|
||||
_console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> Process(RenderContext context, IEnumerable<IRenderable> renderables)
|
||||
{
|
||||
lock (_context.Lock)
|
||||
{
|
||||
yield return _context.Live.PositionCursor();
|
||||
|
||||
foreach (var renderable in renderables)
|
||||
{
|
||||
yield return renderable;
|
||||
}
|
||||
|
||||
yield return _context.Live;
|
||||
}
|
||||
_console.Cursor.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> Process(RenderContext context, IEnumerable<IRenderable> renderables)
|
||||
{
|
||||
lock (_context.Lock)
|
||||
{
|
||||
yield return _context.Live.PositionCursor();
|
||||
|
||||
foreach (var renderable in renderables)
|
||||
{
|
||||
yield return renderable;
|
||||
}
|
||||
|
||||
yield return _context.Live;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user