Why my Box not taking the entire terminal?
Irvingouj opened this issue · comments
Irving Ou commented
Description
I am trying to build a very basic exaple using just a simple box. The code looks like this
impl App {
pub fn run(&mut self, terminal: &mut Terminal<impl Backend>) -> anyhow::Result<()> {
while self.is_running() {
self.draw(terminal)?;
self.handle_events()?;
}
Ok(())
}
fn draw(&self, terminal: &mut Terminal<impl Backend>) -> anyhow::Result<()> {
terminal.draw(|frame| {
frame.render_widget(self, frame.size());
})?;
Ok(())
}
//...
}
//..
impl Widget for &App {
fn render(self, area: ratatui::prelude::Rect, buf: &mut ratatui::prelude::Buffer) {
Block::default()
.borders(ratatui::widgets::Borders::ALL)
.border_type(ratatui::widgets::BorderType::Double)
.render(area, buf);
}
}
To Reproduce
See the code example above
Expected behavior
the box should take the entire space.
Screenshots
Environment
- OS: Mac Vscode Remote to Linux
- Terminal Emulator: Vscode,Zsh
- Font:
- Crate version:
- Backend: Crossterm
Additional context
Josh McKinney commented
This code looks ok. I'm curious what was the problem?
Irving Ou commented
This code looks ok. I'm curious what was the problem?
I miss configured it, :). Sorry this is expected behavior.