diff options
author | bptato <nincsnevem662@gmail.com> | 2022-11-15 17:47:58 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-11-15 17:47:58 +0100 |
commit | 86d05a993463b49d2bd9cc6cb6a7af9b416f802a (patch) | |
tree | 446c75a668695abc341bc32f2d5e21b7edbd8e4f /src/render | |
parent | b00b6a1e1cc6d74bb0b76218ddb4dcf37bef7ac7 (diff) | |
download | chawan-86d05a993463b49d2bd9cc6cb6a7af9b416f802a.tar.gz |
Very much WIP table implementation
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/renderdocument.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim index 484f8fb5..4fddddc7 100644 --- a/src/render/renderdocument.nim +++ b/src/render/renderdocument.nim @@ -261,6 +261,15 @@ proc renderInlineContext(grid: var FlexibleGrid, ctx: InlineContext, x, y: int, let spacing = InlineSpacing(atom) grid.setSpacing(spacing, x, y, term) +proc renderTable(grid: var FlexibleGrid, ctx: TableBox, x, y: int, term: TermAttributes) = + for row in ctx.nested: + assert row.computed{"display"} == DISPLAY_TABLE_ROW + for cell in row.nested: + let x = x + row.offset.x + let y = y + row.offset.y + assert cell.computed{"display"} == DISPLAY_TABLE_CELL + grid.renderBlockContext(cell, x, y, term) + proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockBox, x, y: int, term: TermAttributes) = var stack = newSeqOfCap[(BlockBox, int, int)](100) stack.add((ctx, x, y)) @@ -281,6 +290,8 @@ proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockBox, x, y: int, term: if ctx.inline != nil: assert ctx.nested.len == 0 grid.renderInlineContext(ctx.inline, x, y, term) + elif ctx.computed{"display"} == DISPLAY_TABLE: #TODO INLINE_TABLE + grid.renderTable(TableBox(ctx), x, y, term) else: for i in countdown(ctx.nested.high, 0): stack.add((ctx.nested[i], x, y)) |