From 8e90b08f9bff5cea06210aece17e48a1d4341978 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Tue, 27 Apr 2021 20:44:13 +0700 Subject: [PATCH] Add `MutableText::AppendLineBreak()` method --- sources/Text/MutableText.uc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sources/Text/MutableText.uc b/sources/Text/MutableText.uc index 8a780c7..d13f148 100644 --- a/sources/Text/MutableText.uc +++ b/sources/Text/MutableText.uc @@ -19,6 +19,8 @@ */ class MutableText extends Text; +var private int CODEPOINT_NEWLINE; + // Every formatted `string` essentially consists of multiple differently // formatted (colored) parts. Such `string`s will be more convenient for us to // work with if we separate them from each other. @@ -96,6 +98,17 @@ public final function ToUpper() ConvertCase(false); } +/** + * Appends new line character to the caller `MutableText`. + * + * @return Caller `MutableText` to allow for method chaining. + */ +public final function MutableText AppendLineBreak() +{ + AppendCodePoint(CODEPOINT_NEWLINE); + return self; +} + /** * Appends contents of another `Text` to the caller `MutableText`. * @@ -463,4 +476,5 @@ public final function MutableText ChangeFormatting( defaultproperties { + CODEPOINT_NEWLINE = 10 } \ No newline at end of file