mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-20 13:48:16 +08:00
Fix tree rendering
Fixes some tree rendering problems where lines were not properly drawn at some levels during some circumstances. * Change the API back to only allow one root. * Now uses a stack based approach to rendering instead of recursion. * Removes the need for measuring the whole tree in advance. Leave this up to each child to render.
This commit is contained in:

committed by
Patrik Svensson

parent
0e0f4b4220
commit
8261b25e5c
@ -1,43 +0,0 @@
|
||||
├── Root node
|
||||
│ ├── child1
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 0
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 1
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 2
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 3
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 4
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 5
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 6
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 7
|
||||
│ │ ├── multiple
|
||||
│ │ │ line 8
|
||||
│ │ └── multiple
|
||||
│ │ line 9
|
||||
│ ├── child2
|
||||
│ │ └── child2Child
|
||||
│ │ └── Child 2 child
|
||||
│ │ child
|
||||
│ └── child3
|
||||
│ └── single leaf
|
||||
│ multiline
|
||||
│ └── 2020 January
|
||||
│ ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ │ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
│ ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ │ 1 │ 2 │ 3 │ 4 │
|
||||
│ │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │
|
||||
│ │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │
|
||||
│ │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │
|
||||
│ │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │
|
||||
│ │ │ │ │ │ │ │ │
|
||||
│ └─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
└── child2Child
|
||||
└── Child 2 child
|
||||
child
|
@ -0,0 +1,41 @@
|
||||
Root node
|
||||
╠══ child1
|
||||
║ ╠══ multiple
|
||||
║ ║ line 0
|
||||
║ ╠══ multiple
|
||||
║ ║ line 1
|
||||
║ ╠══ multiple
|
||||
║ ║ line 2
|
||||
║ ╠══ multiple
|
||||
║ ║ line 3
|
||||
║ ╠══ multiple
|
||||
║ ║ line 4
|
||||
║ ╠══ multiple
|
||||
║ ║ line 5
|
||||
║ ╠══ multiple
|
||||
║ ║ line 6
|
||||
║ ╠══ multiple
|
||||
║ ║ line 7
|
||||
║ ╠══ multiple
|
||||
║ ║ line 8
|
||||
║ ╚══ multiple
|
||||
║ line 9
|
||||
╠══ child2
|
||||
║ ╚══ child2-1
|
||||
║ ╚══ Child2-1-1
|
||||
║ child
|
||||
╠══ child3
|
||||
║ ╚══ single leaf
|
||||
║ multiline
|
||||
║ ╚══ 2021 January
|
||||
║ ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
║ │ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
║ ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
║ │ │ │ │ │ │ 1 │ 2 │
|
||||
║ │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │
|
||||
║ │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │
|
||||
║ │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │
|
||||
║ │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │
|
||||
║ │ 31 │ │ │ │ │ │ │
|
||||
║ └─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
╚══ child4
|
@ -1,40 +0,0 @@
|
||||
Root node
|
||||
├── child1
|
||||
│ ├── multiple
|
||||
│ │ line 0
|
||||
│ ├── multiple
|
||||
│ │ line 1
|
||||
│ ├── multiple
|
||||
│ │ line 2
|
||||
│ ├── multiple
|
||||
│ │ line 3
|
||||
│ ├── multiple
|
||||
│ │ line 4
|
||||
│ ├── multiple
|
||||
│ │ line 5
|
||||
│ ├── multiple
|
||||
│ │ line 6
|
||||
│ ├── multiple
|
||||
│ │ line 7
|
||||
│ ├── multiple
|
||||
│ │ line 8
|
||||
│ └── multiple
|
||||
│ line 9
|
||||
├── child2
|
||||
│ └── child2Child
|
||||
│ └── Child 2 child
|
||||
│ child
|
||||
└── child3
|
||||
└── single leaf
|
||||
multiline
|
||||
└── 2020 January
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ 1 │ 2 │ 3 │ 4 │
|
||||
│ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │
|
||||
│ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │
|
||||
│ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │
|
||||
│ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
Reference in New Issue
Block a user