Skip to content

Commit

Permalink
Better orphan display, with dots leading up to the node's level
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 2, 2020
1 parent 3430a8d commit 4d69c34
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/tui/draw/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,23 +332,24 @@ fn level_prefix(entries: &[(Key, Value)], entry_index: usize) -> String {
let adj = Key::adjacency(entries, entry_index);
let key = entries[entry_index].0;
let key_level = key.level();
let adj_level = adj.level();
let is_orphan = adj.level() != key_level;
let mut buf = String::with_capacity(key_level as usize);
for level in 1..=key_level {
use crate::tree::SiblingLocation::*;
let is_child_level = level == key_level;
if level != 1 {
buf.push(' ');
}
if level == 1 && level == key_level {
if level == 1 && is_child_level {
buf.push(match adj[level] {
AboveAndBelow | Above => '├',
NotFound | Below => '│',
});
} else {
let c = if level == key_level {
let c = if is_child_level {
match adj[level] {
NotFound => {
if adj_level == key_level {
if is_orphan {
' '
} else {
'·'
Expand All @@ -364,7 +365,11 @@ fn level_prefix(entries: &[(Key, Value)], entry_index: usize) -> String {
if level == 1 {
'│'
} else {
' '
if is_orphan {
'·'
} else {
' '
}
}
}
Above => '└',
Expand Down

0 comments on commit 4d69c34

Please sign in to comment.