ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀

Home Page:https://ratatui.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why my Box not taking the entire terminal?

Irvingouj opened this issue · comments

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

Screen Shot 2024-04-05 at 9 52 19 PM

Environment

  • OS: Mac Vscode Remote to Linux
  • Terminal Emulator: Vscode,Zsh
  • Font:
  • Crate version:
  • Backend: Crossterm

Additional context

This code looks ok. I'm curious what was the problem?

This code looks ok. I'm curious what was the problem?

I miss configured it, :). Sorry this is expected behavior.