diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-15 18:59:18 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-15 18:59:18 +0100 |
commit | f0de405c6614356928d8700e2e95d00d97ffe2f9 (patch) | |
tree | 09c20a94ad68c9cf9a53084925a52fc93279d03c /src/render | |
parent | 4cd5832ec1bfd02e8afdf5777546cadbe5eaaafb (diff) | |
download | chawan-f0de405c6614356928d8700e2e95d00d97ffe2f9.tar.gz |
Fix console display bugs, add container.location
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/rendertext.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/render/rendertext.nim b/src/render/rendertext.nim index 79bdb541..1031f08d 100644 --- a/src/render/rendertext.nim +++ b/src/render/rendertext.nim @@ -55,6 +55,7 @@ type StreamRenderer* = object format: Format af: bool decoder: DecoderStream + newline: bool proc newStreamRenderer*(stream: Stream): StreamRenderer = result.format = newFormat() @@ -73,6 +74,10 @@ proc renderStream*(grid: var FlexibleGrid, renderer: var StreamRenderer, len: in var buf = newSeq[Rune](len * 4) let n = renderer.decoder.readData(addr buf[0], buf.len * sizeof(buf[0])) while i < n div sizeof(buf[0]): + if renderer.newline: + # avoid newline at end of stream + grid.addLine() + renderer.newline = false let r = buf[i] if r.isAscii(): let c = cast[char](r) @@ -86,7 +91,7 @@ proc renderStream*(grid: var FlexibleGrid, renderer: var StreamRenderer, len: in case c of '\n': add_format - grid.addLine() + renderer.newline = true of '\r': discard of '\t': add_format |