From 86d05a993463b49d2bd9cc6cb6a7af9b416f802a Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 15 Nov 2022 17:47:58 +0100 Subject: Very much WIP table implementation --- src/render/renderdocument.nim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/render') 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)) -- cgit