mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
20 lines
551 B
Rust
20 lines
551 B
Rust
use mlua::{Table, TableExt};
|
|
use ratatui::{buffer::Buffer, widgets::Widget};
|
|
use tracing::error;
|
|
use yazi_plugin::{bindings::Cast, elements::{render_widgets, Rect}, LUA};
|
|
|
|
pub(crate) struct Manager;
|
|
|
|
impl Widget for Manager {
|
|
fn render(self, area: ratatui::layout::Rect, buf: &mut Buffer) {
|
|
let mut f = || {
|
|
let area = Rect::cast(&LUA, area)?;
|
|
let comp: Table = LUA.globals().get("Manager")?;
|
|
render_widgets(comp.call_method("render", area)?, buf);
|
|
Ok::<_, anyhow::Error>(())
|
|
};
|
|
if let Err(e) = f() {
|
|
error!("{:?}", e);
|
|
}
|
|
}
|
|
}
|