diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-27 15:49:20 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-27 15:49:20 +0100 |
commit | 4042ec0dd0515ac9d538e763d6b99b256b640eca (patch) | |
tree | 4d74d7d4a9ee08042731973276560504191ef626 /src/render | |
parent | bd12a8be71fb6774da0f68141cf07f33e5145c86 (diff) | |
download | chawan-4042ec0dd0515ac9d538e763d6b99b256b640eca.tar.gz |
rendertext: fix tab width
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/rendertext.nim | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/render/rendertext.nim b/src/render/rendertext.nim index 362879a2..e3d01638 100644 --- a/src/render/rendertext.nim +++ b/src/render/rendertext.nim @@ -49,17 +49,18 @@ proc renderStream*(grid: var FlexibleGrid, renderer: var StreamRenderer, len: in of '\n': add_format renderer.newline = true - of '\r': discard + continue + of '\r': continue of '\t': add_format - for i in 0 ..< tabwidth - renderer.w: + let w = ((renderer.w div tabwidth) + 1) * tabwidth + while renderer.w < w: grid[^1].str &= ' ' - renderer.w = 0 - of ' ': - add_format - grid[^1].str &= c + inc renderer.w + continue of '\e': renderer.ansiparser.reset() + continue else: add_format grid[^1].str &= c @@ -67,5 +68,3 @@ proc renderStream*(grid: var FlexibleGrid, renderer: var StreamRenderer, len: in add_format grid[^1].str &= r renderer.w += r.width() - while renderer.w >= 8: - renderer.w -= 8 |