Don't throw when console is small

this just returns an empty collection when
take is 0. It leads to some strange output, but
it doesn't blow up.

 #93
This commit is contained in:
Khalid Abuhakmeh 2020-10-08 15:43:48 -04:00 committed by Patrik Svensson
parent ae92c606bb
commit 0a0380ae0a

View File

@ -306,7 +306,7 @@ namespace Spectre.Console.Rendering
{
// 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.");
return new List<Segment>();
}
result.Add(new Segment(segment.Text.Substring(index, take), segment.Style));