diff --git a/default-tiles/status-bar/src/main.rs b/default-tiles/status-bar/src/main.rs index 68f56b7f4..dc0af60e6 100644 --- a/default-tiles/status-bar/src/main.rs +++ b/default-tiles/status-bar/src/main.rs @@ -236,7 +236,7 @@ impl ZellijTile for State { set_max_height(1); } - fn draw(&mut self, _rows: usize, cols: usize) { + fn render(&mut self, _rows: usize, cols: usize) { let help = get_help(); let line_prefix = prefix(&help); let key_path = key_path(&help); diff --git a/default-tiles/strider/src/main.rs b/default-tiles/strider/src/main.rs index 81a31ce1e..08f44707e 100644 --- a/default-tiles/strider/src/main.rs +++ b/default-tiles/strider/src/main.rs @@ -12,7 +12,7 @@ impl ZellijTile for State { refresh_directory(self); } - fn draw(&mut self, rows: usize, cols: usize) { + fn render(&mut self, rows: usize, cols: usize) { for i in 0..rows { if self.selected() < self.scroll() { *self.scroll_mut() = self.selected(); diff --git a/default-tiles/tab-bar/src/main.rs b/default-tiles/tab-bar/src/main.rs index f40a5c1f9..e933420be 100644 --- a/default-tiles/tab-bar/src/main.rs +++ b/default-tiles/tab-bar/src/main.rs @@ -44,7 +44,7 @@ impl ZellijTile for State { self.new_name = String::new(); } - fn draw(&mut self, _rows: usize, cols: usize) { + fn render(&mut self, _rows: usize, cols: usize) { if self.tabs.is_empty() { return; } diff --git a/src/client/panes/plugin_pane.rs b/src/client/panes/plugin_pane.rs index 588cffd63..4cffff5f5 100644 --- a/src/client/panes/plugin_pane.rs +++ b/src/client/panes/plugin_pane.rs @@ -120,7 +120,7 @@ impl Pane for PluginPane { let (buf_tx, buf_rx) = channel(); self.send_plugin_instructions - .send(PluginInstruction::Draw( + .send(PluginInstruction::Render( buf_tx, self.pid, self.rows(), diff --git a/src/common/errors.rs b/src/common/errors.rs index bd9907fa5..b5b96342f 100644 --- a/src/common/errors.rs +++ b/src/common/errors.rs @@ -278,7 +278,7 @@ use crate::wasm_vm::PluginInstruction; #[derive(Debug, Clone, Copy, PartialEq)] pub enum PluginContext { Load, - Draw, + Render, Input, GlobalInput, Unload, @@ -290,7 +290,7 @@ impl From<&PluginInstruction> for PluginContext { fn from(plugin_instruction: &PluginInstruction) -> Self { match *plugin_instruction { PluginInstruction::Load(..) => PluginContext::Load, - PluginInstruction::Draw(..) => PluginContext::Draw, + PluginInstruction::Render(..) => PluginContext::Render, PluginInstruction::Input(..) => PluginContext::Input, PluginInstruction::GlobalInput(_) => PluginContext::GlobalInput, PluginInstruction::Unload(_) => PluginContext::Unload, diff --git a/src/common/mod.rs b/src/common/mod.rs index f0babeaaa..675fe8282 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -522,12 +522,13 @@ pub fn start(mut os_input: Box, opts: CliArgs) { pid_tx.send(plugin_id).unwrap(); plugin_id += 1; } - PluginInstruction::Draw(buf_tx, pid, rows, cols) => { + PluginInstruction::Render(buf_tx, pid, rows, cols) => { let (instance, plugin_env) = plugin_map.get(&pid).unwrap(); - let draw = instance.exports.get_function("draw").unwrap(); + let render = instance.exports.get_function("render").unwrap(); - draw.call(&[Value::I32(rows as i32), Value::I32(cols as i32)]) + render + .call(&[Value::I32(rows as i32), Value::I32(cols as i32)]) .unwrap(); buf_tx.send(wasi_stdout(&plugin_env.wasi_env)).unwrap(); diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs index 9c03ab8a0..788219a40 100644 --- a/src/common/wasm_vm.rs +++ b/src/common/wasm_vm.rs @@ -30,9 +30,9 @@ pub enum PluginInputType { #[derive(Clone, Debug)] pub enum PluginInstruction { Load(Sender, PathBuf, Vec), - Draw(Sender, u32, usize, usize), // String buffer, plugin id, rows, cols - Input(PluginInputType, Vec), // plugin id, input bytes - GlobalInput(Vec), // input bytes + Render(Sender, u32, usize, usize), // String buffer, plugin id, rows, cols + Input(PluginInputType, Vec), // plugin id, input bytes + GlobalInput(Vec), // input bytes Unload(u32), UpdateTabs(Vec), // num tabs, active tab Quit, diff --git a/zellij-tile/src/lib.rs b/zellij-tile/src/lib.rs index ea38f6c9b..6adc9f6dc 100644 --- a/zellij-tile/src/lib.rs +++ b/zellij-tile/src/lib.rs @@ -7,7 +7,8 @@ use data::*; #[allow(unused_variables)] pub trait ZellijTile { fn load(&mut self) {} - fn draw(&mut self, rows: usize, cols: usize) {} + fn render(&mut self, rows: usize, cols: usize) {} + // FIXME: Everything below this line should be purged fn handle_key(&mut self, key: Key) {} fn handle_global_key(&mut self, key: Key) {} fn update_tabs(&mut self) {} @@ -28,9 +29,9 @@ macro_rules! register_tile { } #[no_mangle] - pub fn draw(rows: i32, cols: i32) { + pub fn render(rows: i32, cols: i32) { STATE.with(|state| { - state.borrow_mut().draw(rows as usize, cols as usize); + state.borrow_mut().render(rows as usize, cols as usize); }); }