@@ -138,7 +138,7 @@ private static bool IsGlyphInSupportedRange(char glyph)
138138 /// <summary>
139139 /// ellipsis character.
140140 /// </summary>
141- public static char Ellipsis = IsGlyphInSupportedRange ( '…' ) ? '…' : '.' ;
141+ public static readonly char Ellipsis = IsGlyphInSupportedRange ( '…' ) ? '…' : '.' ;
142142
143143
144144 /// <summary>
@@ -267,22 +267,22 @@ public static Segment[] ToSegment(this string? text, Style defaultstyletext, ICo
267267 color = ParseHexColor ( part ) ;
268268 if ( color == null )
269269 {
270- return [ new Segment ( text ?? string . Empty , defaultstyletext ) ] ;
270+ return [ new Segment ( text , defaultstyletext ) ] ;
271271 }
272272 }
273273 else if ( part . StartsWith ( "rgb" , StringComparison . OrdinalIgnoreCase ) )
274274 {
275275 color = ParseRgbColor ( part ) ;
276276 if ( color == null )
277277 {
278- return [ new Segment ( text ?? string . Empty , defaultstyletext ) ] ;
278+ return [ new Segment ( text , defaultstyletext ) ] ;
279279 }
280280 }
281281 else
282282 {
283283 if ( ! first )
284284 {
285- return [ new Segment ( text ?? string . Empty , defaultstyletext ) ] ;
285+ return [ new Segment ( text , defaultstyletext ) ] ;
286286 }
287287 notfound = true ;
288288 token = new MarkupToken ( MarkupTokenKind . Text , $ "[{ token . Value } ]", token . Position ) ;
@@ -311,7 +311,7 @@ public static Segment[] ToSegment(this string? text, Style defaultstyletext, ICo
311311 onlytext = false ;
312312 if ( stack . Count == 0 )
313313 {
314- return [ new Segment ( text ?? string . Empty , defaultstyletext ) ] ;
314+ return [ new Segment ( text , defaultstyletext ) ] ;
315315 }
316316 Style oldstyle = stack . Pop ( ) ;
317317 if ( stack . Count == 1 )
@@ -323,7 +323,7 @@ public static Segment[] ToSegment(this string? text, Style defaultstyletext, ICo
323323 {
324324 if ( stack . Count == 0 && result . Count == 0 )
325325 {
326- return [ new Segment ( text ?? string . Empty , defaultstyletext ) ] ;
326+ return [ new Segment ( text , defaultstyletext ) ] ;
327327 }
328328 if ( stack . Count > 0 )
329329 {
@@ -349,7 +349,7 @@ public static Segment[] ToSegment(this string? text, Style defaultstyletext, ICo
349349 }
350350 else
351351 {
352- return [ new Segment ( text ?? string . Empty , defaultstyletext ) ] ;
352+ return [ new Segment ( text , defaultstyletext ) ] ;
353353 }
354354 }
355355 return [ .. result ] ;
0 commit comments