diff options
author | bptato <nincsnevem662@gmail.com> | 2021-11-15 21:03:19 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-11-15 21:03:19 +0100 |
commit | d3d9139dd6aa535ed1d7f2c78accd6ac5fa89b3e (patch) | |
tree | 3f21c217de6f8d616d6d455c5f7da2511bff0664 /src/io/cell.nim | |
parent | 9b95435ae6a859f5da69d2fc473099df5102e243 (diff) | |
download | chawan-d3d9139dd6aa535ed1d7f2c78accd6ac5fa89b3e.tar.gz |
Abstract away FlexibleCell, fix pageUp/pageDown
Diffstat (limited to 'src/io/cell.nim')
-rw-r--r-- | src/io/cell.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/io/cell.nim b/src/io/cell.nim index d757c2de..e1b2aef4 100644 --- a/src/io/cell.nim +++ b/src/io/cell.nim @@ -46,6 +46,21 @@ func width*(cell: FixedCell): int = func newFormatting*(): Formatting = return Formatting(fgcolor: defaultColor, bgcolor: defaultColor) +proc addLine*(grid: var FlexibleGrid) = + grid.add(newSeq[FlexibleCell]()) + +proc addCell*(grid: var FlexibleGrid, y: int, r: Rune) = + grid[y].add(FlexibleCell(rune: r)) + +proc addCell*(grid: var FlexibleGrid, y: int, r: Rune, format: Formatting) = + grid[y].add(FlexibleCell(rune: r, formatting: format)) + +proc addCell*(grid: var FlexibleGrid, y: int, r: Rune, format: Formatting, nodes: seq[Node]) = + grid[y].add(FlexibleCell(rune: r, formatting: format, nodes: nodes)) + +proc addCell*(grid: var FlexibleGrid, r: Rune, format: Formatting) = + grid[^1].add(FlexibleCell(rune: r, formatting: format)) + proc setText*(grid: var FlexibleGrid, x: int, y: int, text: seq[Rune]) = while grid.len <= y: grid.add(newSeq[FlexibleCell]()) |