diff options
Diffstat (limited to 'src/render/rendertext.nim')
-rw-r--r-- | src/render/rendertext.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/render/rendertext.nim b/src/render/rendertext.nim index 4c6b56ec..b5054e7b 100644 --- a/src/render/rendertext.nim +++ b/src/render/rendertext.nim @@ -16,9 +16,8 @@ proc renderPlainText*(text: string): FlexibleGrid = while i < text.len: case text[i] of '\n': - if i != text.len - 1: - add_format - result.addLine() + add_format + result.addLine() of '\r': discard of '\t': add_format @@ -35,6 +34,9 @@ proc renderPlainText*(text: string): FlexibleGrid = result[^1].str &= text[i] inc i + if result.len > 1 and result[^1].str.len == 0 and result[^1].formats.len == 0: + discard result.pop() + proc renderStream*(stream: Stream): FlexibleGrid = var format = newFormatting() template add_format() = @@ -64,3 +66,6 @@ proc renderStream*(stream: Stream): FlexibleGrid = else: add_format result[^1].str &= c + + if result.len > 1 and result[^1].str.len == 0 and result[^1].formats.len == 0: + discard result.pop() |