mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-11-03 10:25:26 +08:00
Add support for rendering exceptions
This commit is contained in:
committed by
Patrik Svensson
parent
971f9032ba
commit
3c3afe7439
@@ -239,7 +239,7 @@ namespace Spectre.Console.Rendering
|
||||
}
|
||||
|
||||
// Same style?
|
||||
if (previous.Style.Equals(segment.Style))
|
||||
if (previous.Style.Equals(segment.Style) && !previous.IsLineBreak)
|
||||
{
|
||||
previous = new Segment(previous.Text + segment.Text, previous.Style);
|
||||
}
|
||||
@@ -299,7 +299,15 @@ namespace Spectre.Console.Rendering
|
||||
while (lengthLeft > 0)
|
||||
{
|
||||
var index = totalLength - lengthLeft;
|
||||
|
||||
// How many characters should we take?
|
||||
var take = Math.Min(width, totalLength - index);
|
||||
if (take == 0)
|
||||
{
|
||||
// This shouldn't really occur, but I don't like
|
||||
// never ending loops if it does...
|
||||
throw new InvalidOperationException("Text folding failed since 'take' was zero.");
|
||||
}
|
||||
|
||||
result.Add(new Segment(segment.Text.Substring(index, take), segment.Style));
|
||||
lengthLeft -= take;
|
||||
|
||||
Reference in New Issue
Block a user