gyscos / gyscos/cursive

[BUG] adding content causes views to be pushed off screen.

Open
#613 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

The following code walks the bottom panel off the bottom of the screen.

While I suppose its height is still the required height, but it's off the screen, so who knows.

I think this is a bug?

If it's not, how do I keep both panels on the screen?

Great crate BTW. It's been fun to use.

```rust
fn main() {
let mut ui = CursiveRunnable::default();
let mut ui = ui.runner();

let mut bottom_content = String::with_capacity(1023);
for n in (1..11).rev() {
bottom_content.push_str(&format!("{} Line num\n", n));
}

ui.add_layer(
LinearLayout::vertical()
.child(ResizedView::with_min_height(
10,
Panel::new(TextView::new("top content\n").with_name("top")).title("Top Panel"),
))
.child(ResizedView::with_min_height(
10,
Panel::new(TextView::new(bottom_content).with_name("bottom")).title("Bottom Panel"),
)),
);

ui.add_global_callback('q', |s| s.quit());

ui.refresh();
ui.step();

while ui.is_running() {
std::thread::sleep(std::time::Duration::from_millis(500));

ui.call_on_name("top", |view: &mut TextView| {
view.append(format!("now is {:?}\n", std::time::Instant::now()))
});

ui.refresh();
ui.step();
}
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.