aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/compositor.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-13 03:23:50 +0000
committerBlaž Hrastnik2020-12-13 03:23:50 +0000
commit8695415fbfe927250f68e93793660e3c4e4a70b4 (patch)
tree829bb12d6fe17d322b1586871c3aeacc095d9f58 /helix-term/src/compositor.rs
parent29cb33300b1486c778e9318e87e60c26695c2520 (diff)
wip: Move to new rendering structure.
Diffstat (limited to 'helix-term/src/compositor.rs')
-rw-r--r--helix-term/src/compositor.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs
index 3cf6bf03..1d94ee63 100644
--- a/helix-term/src/compositor.rs
+++ b/helix-term/src/compositor.rs
@@ -13,10 +13,10 @@
// Q: how does this work with popups?
// cursive does compositor.screen_mut().add_layer_at(pos::absolute(x, y), <component>)
-use crate::application::Renderer;
use crossterm::event::Event;
use smol::Executor;
use tui::buffer::Buffer as Surface;
+use tui::layout::Rect;
pub type Callback = Box<dyn Fn(&mut Compositor)>;
@@ -36,9 +36,9 @@ pub enum EventResult {
use helix_view::{Editor, View};
// shared with commands.rs
-pub struct Context<'a, 'b> {
+pub struct Context<'a> {
pub editor: &'a mut Editor,
- pub executor: &'a smol::Executor<'b>,
+ pub executor: &'static smol::Executor<'static>,
}
pub trait Component {
@@ -51,7 +51,7 @@ pub trait Component {
true
}
- fn render(&mut self, renderer: &mut Renderer, ctx: &mut Context);
+ fn render(&self, area: Rect, frame: &mut Surface, ctx: &mut Context);
}
// struct Editor { };
@@ -133,9 +133,9 @@ impl Compositor {
false
}
- pub fn render(&mut self, renderer: &mut Renderer, cx: &mut Context) {
- for layer in &mut self.layers {
- layer.render(renderer, cx)
+ pub fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
+ for layer in &self.layers {
+ layer.render(area, surface, cx)
}
}
}