mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00

committed by
Patrik Svensson

parent
9637066927
commit
d475e3b30a
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Spectre.Console.Internal;
|
||||
|
||||
namespace Spectre.Console
|
||||
{
|
||||
@ -20,12 +19,7 @@ namespace Spectre.Console
|
||||
throw new ArgumentNullException(nameof(console));
|
||||
}
|
||||
|
||||
using (console.PushColor(Color.Default, true))
|
||||
using (console.PushColor(Color.Default, false))
|
||||
using (console.PushDecoration(Decoration.None))
|
||||
{
|
||||
console.Write(Environment.NewLine);
|
||||
}
|
||||
console.Write(Environment.NewLine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -60,12 +60,19 @@ namespace Spectre.Console.Internal
|
||||
return;
|
||||
}
|
||||
|
||||
_out.Write(AnsiBuilder.GetAnsi(
|
||||
_system,
|
||||
text.NormalizeLineEndings(native: true),
|
||||
Decoration,
|
||||
Foreground,
|
||||
Background));
|
||||
var parts = text.NormalizeLineEndings().Split(new[] { '\n' });
|
||||
foreach (var (_, _, last, part) in parts.Enumerate())
|
||||
{
|
||||
if (!string.IsNullOrEmpty(part))
|
||||
{
|
||||
_out.Write(AnsiBuilder.GetAnsi(_system, part, Decoration, Foreground, Background));
|
||||
}
|
||||
|
||||
if (!last)
|
||||
{
|
||||
_out.Write(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user