aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-03-25 17:22:10 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2021-03-25 17:22:10 +0000
commitb6f945da35065f0a0d3b384b4d0f167908c0140f (patch)
tree2fe792360569c829ca4bdd2c66f3a6a9e0748e7f /src
parentConverted tab updates to the new generic update() function (diff)
downloadsl0ppij-b6f945da35065f0a0d3b384b4d0f167908c0140f.tar.gz
sl0ppij-b6f945da35065f0a0d3b384b4d0f167908c0140f.tar.xz
sl0ppij-b6f945da35065f0a0d3b384b4d0f167908c0140f.zip
Wrap up the plugin system refactor, running everything through update()
Diffstat (limited to 'src')
-rw-r--r--src/client/layout.rs8
-rw-r--r--src/client/tab.rs153
-rw-r--r--src/common/errors.rs2
-rw-r--r--src/common/input/actions.rs1
-rw-r--r--src/common/input/handler.rs24
-rw-r--r--src/common/input/keybinds.rs5
-rw-r--r--src/common/mod.rs80
-rw-r--r--src/common/os_input_output.rs13
-rw-r--r--src/common/screen.rs17
-rw-r--r--src/common/utils/consts.rs2
-rw-r--r--src/common/wasm_vm.rs15
11 files changed, 89 insertions, 231 deletions
diff --git a/src/client/layout.rs b/src/client/layout.rs
index 33df2a2f..2d1daaf4 100644
--- a/src/client/layout.rs
+++ b/src/client/layout.rs
@@ -1,10 +1,8 @@
-use crate::utils::consts::ZELLIJ_ROOT_LAYOUT_DIR;
use directories_next::ProjectDirs;
use serde::{Deserialize, Serialize};
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use std::{fs::File, io::prelude::*};
-use crate::common::wasm_vm::NaughtyEventType;
use crate::panes::PositionAndSize;
fn split_space_to_parts_vertically(
@@ -181,19 +179,15 @@ pub struct Layout {
pub plugin: Option<PathBuf>,
#[serde(default)]
pub expansion_boundary: bool,
- #[serde(default, skip_serializing_if = "Vec::is_empty")]
- pub events: Vec<NaughtyEventType>,
}
impl Layout {
pub fn new(layout_path: PathBuf) -> Self {
let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
let layout_dir = project_dirs.data_dir().join("layouts/");
- let root_layout_dir = Path::new(ZELLIJ_ROOT_LAYOUT_DIR);
let mut layout_file = File::open(&layout_path)
.or_else(|_| File::open(&layout_path.with_extension("yaml")))
.or_else(|_| File::open(&layout_dir.join(&layout_path).with_extension("yaml")))
- .or_else(|_| File::open(root_layout_dir.join(&layout_path).with_extension("yaml")))
.unwrap_or_else(|_| panic!("cannot find layout {}", &layout_path.display()));
let mut layout = String::new();
diff --git a/src/client/tab.rs b/src/client/tab.rs
index b74c2eb7..1e56fd8b 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -258,11 +258,7 @@ impl Tab {
if let Some(plugin) = &layout.plugin {
let (pid_tx, pid_rx) = channel();
self.send_plugin_instructions
- .send(PluginInstruction::Load(
- pid_tx,
- plugin.clone(),
- layout.events.clone(),
- ))
+ .send(PluginInstruction::Load(pid_tx, plugin.clone()))
.unwrap();
let pid = pid_rx.recv().unwrap();
let new_plugin = PluginPane::new(
@@ -301,7 +297,6 @@ impl Tab {
self.toggle_active_pane_fullscreen();
}
if !self.has_panes() {
- // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid {
let new_terminal = TerminalPane::new(term_pid, self.full_screen_ws);
self.os_api.set_terminal_size_using_fd(
@@ -352,7 +347,6 @@ impl Tab {
if terminal_to_split.rows() * CURSOR_HEIGHT_WIDTH_RATIO > terminal_to_split.columns()
&& terminal_to_split.rows() > terminal_to_split.min_height() * 2
{
- // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid {
let (top_winsize, bottom_winsize) = split_horizontally_with_gap(&terminal_ws);
let new_terminal = TerminalPane::new(term_pid, bottom_winsize);
@@ -373,7 +367,6 @@ impl Tab {
self.active_terminal = Some(pid);
}
} else if terminal_to_split.columns() > terminal_to_split.min_width() * 2 {
- // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid {
let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws);
let new_terminal = TerminalPane::new(term_pid, right_winsize);
@@ -403,7 +396,6 @@ impl Tab {
self.toggle_active_pane_fullscreen();
}
if !self.has_panes() {
- // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid {
let new_terminal = TerminalPane::new(term_pid, self.full_screen_ws);
self.os_api.set_terminal_size_using_fd(
@@ -414,47 +406,44 @@ impl Tab {
self.panes.insert(pid, Box::new(new_terminal));
self.active_terminal = Some(pid);
}
- } else {
- // FIXME: This could use a second look
- if let PaneId::Terminal(term_pid) = pid {
- // TODO: check minimum size of active terminal
- let active_pane_id = &self.get_active_pane_id().unwrap();
- let active_pane = self.panes.get_mut(active_pane_id).unwrap();
- if active_pane.rows() < MIN_TERMINAL_HEIGHT * 2 + 1 {
- self.send_pty_instructions
- .send(PtyInstruction::ClosePane(pid)) // we can't open this pane, close the pty
- .unwrap();
- return;
- }
- let terminal_ws = PositionAndSize {
- x: active_pane.x(),
- y: active_pane.y(),
- rows: active_pane.rows(),
- columns: active_pane.columns(),
- };
- let (top_winsize, bottom_winsize) = split_horizontally_with_gap(&terminal_ws);
+ } else if let PaneId::Terminal(term_pid) = pid {
+ // TODO: check minimum size of active terminal
+ let active_pane_id = &self.get_active_pane_id().unwrap();
+ let active_pane = self.panes.get_mut(active_pane_id).unwrap();
+ if active_pane.rows() < MIN_TERMINAL_HEIGHT * 2 + 1 {
+ self.send_pty_instructions
+ .send(PtyInstruction::ClosePane(pid)) // we can't open this pane, close the pty
+ .unwrap();
+ return;
+ }
+ let terminal_ws = PositionAndSize {
+ x: active_pane.x(),
+ y: active_pane.y(),
+ rows: active_pane.rows(),
+ columns: active_pane.columns(),
+ };
+ let (top_winsize, bottom_winsize) = split_horizontally_with_gap(&terminal_ws);
+
+ active_pane.change_pos_and_size(&top_winsize);
- active_pane.change_pos_and_size(&top_winsize);
+ let new_terminal = TerminalPane::new(term_pid, bottom_winsize);
+ self.os_api.set_terminal_size_using_fd(
+ new_terminal.pid,
+ bottom_winsize.columns as u16,
+ bottom_winsize.rows as u16,
+ );
+ self.panes.insert(pid, Box::new(new_terminal));
- let new_terminal = TerminalPane::new(term_pid, bottom_winsize);
+ if let PaneId::Terminal(active_terminal_pid) = active_pane_id {
self.os_api.set_terminal_size_using_fd(
- new_terminal.pid,
- bottom_winsize.columns as u16,
- bottom_winsize.rows as u16,
+ *active_terminal_pid,
+ top_winsize.columns as u16,
+ top_winsize.rows as u16,
);
- self.panes.insert(pid, Box::new(new_terminal));
-
- if let PaneId::Terminal(active_terminal_pid) = active_pane_id {
- self.os_api.set_terminal_size_using_fd(
- *active_terminal_pid,
- top_winsize.columns as u16,
- top_winsize.rows as u16,
- );
- }
-
- self.active_terminal = Some(pid);
- self.render();
}
+
+ self.active_terminal = Some(pid);
+ self.render();
}
}
pub fn vertical_split(&mut self, pid: PaneId) {
@@ -463,7 +452,6 @@ impl Tab {
self.toggle_active_pane_fullscreen();
}
if !self.has_panes() {
- // FIXME: This could use a second look
if let PaneId::Terminal(term_pid) = pid {
let new_terminal = TerminalPane::new(term_pid, self.full_screen_ws);
self.os_api.set_terminal_size_using_fd(
@@ -474,47 +462,44 @@ impl Tab {
self.panes.insert(pid, Box::new(new_terminal));
self.active_terminal = Some(pid);
}
- } else {
- // FIXME: This could use a second look
- if let PaneId::Terminal(term_pid) = pid {
- // TODO: check minimum size of active terminal
- let active_pane_id = &self.get_active_pane_id().unwrap();
- let active_pane = self.panes.get_mut(active_pane_id).unwrap();
- if active_pane.columns() < MIN_TERMINAL_WIDTH * 2 + 1 {
- self.send_pty_instructions
- .send(PtyInstruction::ClosePane(pid)) // we can't open this pane, close the pty
- .unwrap();
- return;
- }
- let terminal_ws = PositionAndSize {
- x: active_pane.x(),
- y: active_pane.y(),
- rows: active_pane.rows(),
- columns: active_pane.columns(),
- };
- let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws);
+ } else if let PaneId::Terminal(term_pid) = pid {
+ // TODO: check minimum size of active terminal
+ let active_pane_id = &self.get_active_pane_id().unwrap();
+ let active_pane = self.panes.get_mut(active_pane_id).unwrap();
+ if active_pane.columns() < MIN_TERMINAL_WIDTH * 2 + 1 {
+ self.send_pty_instructions
+ .send(PtyInstruction::ClosePane(pid)) // we can't open this pane, close the pty
+ .unwrap();
+ return;
+ }
+ let terminal_ws = PositionAndSize {
+ x: active_pane.x(),
+ y: active_pane.y(),
+ rows: active_pane.rows(),
+ columns: active_pane.columns(),
+ };
+ let (left_winsize, right_winsize) = split_vertically_with_gap(&terminal_ws);
- active_pane.change_pos_and_size(&left_winsize);
+ active_pane.change_pos_and_size(&left_winsize);
- let new_terminal = TerminalPane::new(term_pid, right_winsize);
+ let new_terminal = TerminalPane::new(term_pid, right_winsize);
+ self.os_api.set_terminal_size_using_fd(
+ new_terminal.pid,
+ right_winsize.columns as u16,
+ right_winsize.rows as u16,
+ );
+ self.panes.insert(pid, Box::new(new_terminal));
+
+ if let PaneId::Terminal(active_terminal_pid) = active_pane_id {
self.os_api.set_terminal_size_using_fd(
- new_terminal.pid,
- right_winsize.columns as u16,
- right_winsize.rows as u16,
+ *active_terminal_pid,
+ left_winsize.columns as u16,
+ left_winsize.rows as u16,
);
- self.panes.insert(pid, Box::new(new_terminal));
-
- if let PaneId::Terminal(active_terminal_pid) = active_pane_id {
- self.os_api.set_terminal_size_using_fd(
- *active_terminal_pid,
- left_winsize.columns as u16,
- left_winsize.rows as u16,
- );
- }
-
- self.active_terminal = Some(pid);
- self.render();
}
+
+ self.active_terminal = Some(pid);
+ self.render();
}
}
pub fn get_active_pane(&self) -> Option<&dyn Pane> {
@@ -1680,6 +1665,7 @@ impl Tab {
self.reduce_pane_and_surroundings_right(&active_pane_id, count);
}
}
+ self.render();
}
pub fn resize_left(&mut self) {
// TODO: find out by how much we actually reduced and only reduce by that much
@@ -1691,6 +1677,7 @@ impl Tab {
self.reduce_pane_and_surroundings_left(&active_pane_id, count);
}
}
+ self.render();
}
pub fn resize_down(&mut self) {
// TODO: find out by how much we actually reduced and only reduce by that much
@@ -1702,6 +1689,7 @@ impl Tab {
self.reduce_pane_and_surroundings_down(&active_pane_id, count);
}
}
+ self.render();
}
pub fn resize_up(&mut self) {
// TODO: find out by how much we actually reduced and only reduce by that much
@@ -1713,6 +1701,7 @@ impl Tab {
self.reduce_pane_and_surroundings_up(&active_pane_id, count);
}
}
+ self.render();
}
pub fn move_focus(&mut self) {
if !self.has_selectable_panes() {
diff --git a/src/common/errors.rs b/src/common/errors.rs
index 83860a59..f5aeae85 100644
--- a/src/common/errors.rs
+++ b/src/common/errors.rs
@@ -282,7 +282,6 @@ pub enum PluginContext {
Load,
Update,
Render,
- Input,
Unload,
Quit,
}
@@ -293,7 +292,6 @@ impl From<&PluginInstruction> for PluginContext {
PluginInstruction::Load(..) => PluginContext::Load,
PluginInstruction::Update(..) => PluginContext::Update,
PluginInstruction::Render(..) => PluginContext::Render,
- PluginInstruction::Input(..) => PluginContext::Input,
PluginInstruction::Unload(_) => PluginContext::Unload,
PluginInstruction::Quit => PluginContext::Quit,
}
diff --git a/src/common/input/actions.rs b/src/common/input/actions.rs
index 059255d3..f4226864 100644
--- a/src/common/input/actions.rs
+++ b/src/common/input/actions.rs
@@ -49,5 +49,4 @@ pub enum Action {
CloseTab,
GoToTab(u32),
TabNameInput(Vec<u8>),
- SaveTabName,
}
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs
index 3444471a..33f4e5dc 100644
--- a/src/common/input/handler.rs
+++ b/src/common/input/handler.rs
@@ -7,7 +7,7 @@ use crate::errors::ContextType;
use crate::os_input_output::OsApi;
use crate::pty_bus::PtyInstruction;
use crate::screen::ScreenInstruction;
-use crate::wasm_vm::{NaughtyEventType, PluginInputType, PluginInstruction};
+use crate::wasm_vm::PluginInstruction;
use crate::CommandIsExecuting;
use termion::input::{TermRead, TermReadEventsAndRaw};
@@ -66,11 +66,6 @@ impl InputHandler {
Ok((event, raw_bytes)) => match event {
termion::event::Event::Key(key) => {
let key = cast_termion_key(key);
- // FIXME: This is a bit of a hack to get resizing to work!
- drop(
- self.send_screen_instructions
- .send(ScreenInstruction::Render),
- );
// FIXME this explicit break is needed because the current test
// framework relies on it to not create dead threads that loop
// and eat up CPUs. Do not remove until the test framework has
@@ -237,27 +232,10 @@ impl InputHandler {
.unwrap();
}
Action::TabNameInput(c) => {
- self.send_plugin_instructions
- .send(PluginInstruction::Input(
- PluginInputType::Event(NaughtyEventType::Tab),
- c.clone(),
- ))
- .unwrap();
self.send_screen_instructions
.send(ScreenInstruction::UpdateTabName(c))
.unwrap();
}
- Action::SaveTabName => {
- self.send_plugin_instructions
- .send(PluginInstruction::Input(
- PluginInputType::Event(NaughtyEventType::Tab),
- vec![b'\n'],
- ))
- .unwrap();
- self.send_screen_instructions
- .send(ScreenInstruction::UpdateTabName(vec![b'\n']))
- .unwrap();
- }
Action::NoOp => {}
}
diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs
index e48d3115..7b1e8779 100644
--- a/src/common/input/keybinds.rs
+++ b/src/common/input/keybinds.rs
@@ -226,10 +226,7 @@ fn get_defaults_for_mode(mode: &InputMode) -> ModeKeybinds {
defaults.insert(Key::Up, vec![Action::ScrollUp]);
}
InputMode::RenameTab => {
- defaults.insert(
- Key::Char('\n'),
- vec![Action::SaveTabName, Action::SwitchToMode(InputMode::Tab)],
- );
+ defaults.insert(Key::Char('\n'), vec![Action::SwitchToMode(InputMode::Tab)]);
defaults.insert(
Key::Ctrl('g'),
vec![Action::SwitchToMode(InputMode::Normal)],
diff --git a/src/common/mod.rs b/src/common/mod.rs
index 15a28d96..e895fcc0 100644
--- a/src/common/mod.rs
+++ b/src/common/mod.rs
@@ -10,7 +10,7 @@ pub mod utils;
pub mod wasm_vm;
use std::cell::RefCell;
-use std::path::{Path, PathBuf};
+use std::path::PathBuf;
use std::sync::mpsc;
use std::thread;
use std::{collections::HashMap, fs};
@@ -32,16 +32,12 @@ use os_input_output::OsApi;
use pty_bus::{PtyBus, PtyInstruction};
use screen::{Screen, ScreenInstruction};
use serde::{Deserialize, Serialize};
-use termion::input::TermRead;
-use utils::consts::{ZELLIJ_IPC_PIPE, ZELLIJ_ROOT_PLUGIN_DIR};
+use utils::consts::ZELLIJ_IPC_PIPE;
use wasm_vm::PluginEnv;
-use wasm_vm::{
- wasi_stdout, wasi_write_string, zellij_imports, NaughtyEventType, PluginInputType,
- PluginInstruction,
-};
+use wasm_vm::{wasi_stdout, wasi_write_string, zellij_imports, PluginInstruction};
use wasmer::{ChainableNamedResolver, Instance, Module, Store, Value};
use wasmer_wasi::{Pipe, WasiState};
-use zellij_tile::data::{EventType, InputMode, Key};
+use zellij_tile::data::{EventType, InputMode};
#[derive(Serialize, Deserialize, Debug)]
pub enum ApiCommand {
@@ -352,8 +348,6 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
.get_active_tab_mut()
.unwrap()
.set_pane_selectable(id, selectable);
- // FIXME: Is this needed?
- screen.render();
}
ScreenInstruction::SetMaxHeight(id, max_height) => {
screen
@@ -417,42 +411,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
let store = Store::default();
let mut plugin_id = 0;
let mut plugin_map = HashMap::new();
- let handler_map: HashMap<NaughtyEventType, String> = [(
- NaughtyEventType::Tab,
- "handle_tab_rename_keypress".to_string(),
- )]
- .iter()
- .cloned()
- .collect();
-
move || loop {
- // FIXME: This 100% *must* be destroyed before this makes in into main!!!!!!!!!!!
- fn cast_termion_key(event: termion::event::Key) -> Key {
- match event {
- termion::event::Key::Backspace => Key::Backspace,
- termion::event::Key::Left => Key::Left,
- termion::event::Key::Right => Key::Right,
- termion::event::Key::Up => Key::Up,
- termion::event::Key::Down => Key::Down,
- termion::event::Key::Home => Key::Home,
- termion::event::Key::End => Key::End,
- termion::event::Key::PageUp => Key::PageUp,
- termion::event::Key::PageDown => Key::PageDown,
- termion::event::Key::BackTab => Key::BackTab,
- termion::event::Key::Delete => Key::Delete,
- termion::event::Key::Insert => Key::Insert,
- termion::event::Key::F(n) => Key::F(n),
- termion::event::Key::Char(c) => Key::Char(c),
- termion::event::Key::Alt(c) => Key::Alt(c),
- termion::event::Key::Ctrl(c) => Key::Ctrl(c),
- termion::event::Key::Null => Key::Null,
- termion::event::Key::Esc => Key::Esc,
- _ => {
- unimplemented!("Encountered an unknown key!")
- }
- }
- }
-
let (event, mut err_ctx) = receive_plugin_instructions
.recv()
.expect("failed to receive event on channel");
@@ -461,18 +420,13 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
send_pty_instructions.update(err_ctx);
send_app_instructions.update(err_ctx);
match event {
- PluginInstruction::Load(pid_tx, path, events) => {
+ PluginInstruction::Load(pid_tx, path) => {
let project_dirs =
ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
let plugin_dir = project_dirs.data_dir().join("plugins/");
- // FIXME: This really shouldn't need to exist anymore, let's get rid of it!
- let root_plugin_dir = Path::new(ZELLIJ_ROOT_PLUGIN_DIR);
let wasm_bytes = fs::read(&path)
.or_else(|_| fs::read(&path.with_extension("wasm")))
.or_else(|_| fs::read(&plugin_dir.join(&path).with_extension("wasm")))
- .or_else(|_| {
- fs::read(&root_plugin_dir.join(&path).with_extension("wasm"))
- })
.unwrap_or_else(|_| panic!("cannot find plugin {}", &path.display()));
// FIXME: Cache this compiled module on disk. I could use `(de)serialize_to_file()` for that
@@ -504,7 +458,6 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
send_app_instructions: send_app_instructions.clone(),
wasi_env,
subscriptions: Arc::new(Mutex::new(HashSet::new())),
- events,
};
let zellij = zellij_imports(&store, &plugin_env);
@@ -546,29 +499,6 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
buf_tx.send(wasi_stdout(&plugin_env.wasi_env)).unwrap();
}
- // FIXME: Deduplicate this with the callback below!
- PluginInstruction::Input(input_type, input_bytes) => {
- let PluginInputType::Event(event) = input_type;
- for (instance, plugin_env) in plugin_map.values() {
- if !plugin_env.events.contains(&event) {
- continue;
- }
- let handle_key = instance
- .exports
- .get_function(handler_map.get(&event).unwrap())
- .unwrap();
- for key in input_bytes.keys().flatten() {
- let key = cast_termion_key(key);
- wasi_write_string(
- &plugin_env.wasi_env,
- &serde_json::to_string(&key).unwrap(),
- );
- handle_key.call(&[]).unwrap();
- }
- }
-
- drop(send_screen_instructions.send(ScreenInstruction::Render));
- }
PluginInstruction::Unload(pid) => drop(plugin_map.remove(&pid)),
PluginInstruction::Quit => break,
}
diff --git a/src/common/os_input_output.rs b/src/common/os_input_output.rs
index 26a7d497..043a9aea 100644
--- a/src/common/os_input_output.rs
+++ b/src/common/os_input_output.rs
@@ -82,15 +82,10 @@ fn handle_command_exit(mut child: Child) {
}
for signal in signals.pending() {
- // FIXME: We need to handle more signals here!
- #[allow(clippy::single_match)]
- match signal {
- signal_hook::SIGINT => {
- child.kill().unwrap();
- child.wait().unwrap();
- break 'handle_exit;
- }
- _ => {}
+ if signal == signal_hook::SIGINT {
+ child.kill().unwrap();
+ child.wait().unwrap();
+ break 'handle_exit;
}
}
}
diff --git a/src/common/screen.rs b/src/common/screen.rs
index e902099c..5208834a 100644
--- a/src/common/screen.rs
+++ b/src/common/screen.rs
@@ -74,7 +74,6 @@ pub struct Screen {
active_tab_index: Option<usize>,
/// The [`OsApi`] this [`Screen`] uses.
os_api: Box<dyn OsApi>,
- tabname_buf: String,
input_mode: InputMode,
}
@@ -100,7 +99,6 @@ impl Screen {
active_tab_index: None,
tabs: BTreeMap::new(),
os_api,
- tabname_buf: String::new(),
input_mode,
}
}
@@ -288,25 +286,20 @@ impl Screen {
pub fn update_active_tab_name(&mut self, buf: Vec<u8>) {
let s = str::from_utf8(&buf).unwrap();
+ let active_tab = self.get_active_tab_mut().unwrap();
match s {
"\0" => {
- self.tabname_buf = String::new();
- }
- "\n" => {
- let new_name = self.tabname_buf.clone();
- let active_tab = self.get_active_tab_mut().unwrap();
- active_tab.name = new_name;
- self.update_tabs();
- self.render();
+ active_tab.name = String::new();
}
"\u{007F}" | "\u{0008}" => {
//delete and backspace keys
- self.tabname_buf.pop();
+ active_tab.name.pop();
}
c => {
- self.tabname_buf.push_str(c);
+ active_tab.name.push_str(c);
}
}
+ self.update_tabs();
}
pub fn change_input_mode(&mut self, input_mode: InputMode) {
self.input_mode = input_mode;
diff --git a/src/common/utils/consts.rs b/src/common/utils/consts.rs
index fa9eee0d..663a545d 100644
--- a/src/common/utils/consts.rs
+++ b/src/common/utils/consts.rs
@@ -4,5 +4,3 @@ pub const ZELLIJ_TMP_DIR: &str = "/tmp/zellij";
pub const ZELLIJ_TMP_LOG_DIR: &str = "/tmp/zellij/zellij-log";
pub const ZELLIJ_TMP_LOG_FILE: &str = "/tmp/zellij/zellij-log/log.txt";
pub const ZELLIJ_IPC_PIPE: &str = "/tmp/zellij/ipc";
-pub const ZELLIJ_ROOT_PLUGIN_DIR: &str = "/usr/share/zellij/plugins";
-pub const ZELLIJ_ROOT_LAYOUT_DIR: &str = "/usr/share/zellij/layouts";
diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs
index 249ad9ca..29b110ae 100644
--- a/src/common/wasm_vm.rs
+++ b/src/common/wasm_vm.rs
@@ -1,4 +1,3 @@
-use serde::{Deserialize, Serialize};
use std::{
collections::HashSet,
path::PathBuf,
@@ -12,22 +11,11 @@ use super::{
pty_bus::PtyInstruction, screen::ScreenInstruction, AppInstruction, PaneId, SenderWithContext,
};
-#[derive(Clone, Debug, PartialEq, Hash, Eq, Serialize, Deserialize)]
-pub enum NaughtyEventType {
- Tab,
-}
-
-#[derive(Clone, Debug)]
-pub enum PluginInputType {
- Event(NaughtyEventType),
-}
-
#[derive(Clone, Debug)]
pub enum PluginInstruction {
- Load(Sender<u32>, PathBuf, Vec<NaughtyEventType>),
+ Load(Sender<u32>, PathBuf),
Update(Option<u32>, Event), // Focused plugin / broadcast, event data
Render(Sender<String>, u32, usize, usize), // String buffer, plugin id, rows, cols
- Input(PluginInputType, Vec<u8>), // plugin id, input bytes
Unload(u32),
Quit,
}
@@ -40,7 +28,6 @@ pub struct PluginEnv {
pub send_pty_instructions: SenderWithContext<PtyInstruction>, // FIXME: This should be a big bundle of all of the channels
pub wasi_env: WasiEnv,
pub subscriptions: Arc<Mutex<HashSet<EventType>>>,
- pub events: Vec<NaughtyEventType>, // FIXME: Murder this very soon (should not survive into main)
}
// Plugin API ---------------------------------------------------------------------------------------------------------