Bit of renaming

This commit is contained in:
Kyle Sutherland-Cash 2021-05-01 09:22:21 -07:00
parent e7d8aefa79
commit 2eadcb86a5
2 changed files with 13 additions and 21 deletions

View file

@ -550,18 +550,10 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
let plugin_env = PluginEnv { let plugin_env = PluginEnv {
plugin_id, plugin_id,
send_pty_instructions: plugin_bus.to_pty.as_ref().unwrap().clone(), to_pty: plugin_bus.to_pty.as_ref().unwrap().clone(),
send_screen_instructions: plugin_bus to_screen: plugin_bus.to_screen.as_ref().unwrap().clone(),
.to_screen to_app: plugin_bus.to_app.as_ref().unwrap().clone(),
.as_ref() to_plugin: plugin_bus.to_plugin.as_ref().unwrap().clone(),
.unwrap()
.clone(),
send_app_instructions: plugin_bus.to_app.as_ref().unwrap().clone(),
send_plugin_instructions: plugin_bus
.to_plugin
.as_ref()
.unwrap()
.clone(),
wasi_env, wasi_env,
subscriptions: Arc::new(Mutex::new(HashSet::new())), subscriptions: Arc::new(Mutex::new(HashSet::new())),
}; };

View file

@ -28,10 +28,10 @@ pub enum PluginInstruction {
pub struct PluginEnv { pub struct PluginEnv {
pub plugin_id: u32, pub plugin_id: u32,
// FIXME: This should be a big bundle of all of the channels // FIXME: This should be a big bundle of all of the channels
pub send_screen_instructions: SenderWithContext<ScreenInstruction>, pub to_screen: SenderWithContext<ScreenInstruction>,
pub send_app_instructions: SenderWithContext<AppInstruction>, pub to_app: SenderWithContext<AppInstruction>,
pub send_pty_instructions: SenderWithContext<PtyInstruction>, pub to_pty: SenderWithContext<PtyInstruction>,
pub send_plugin_instructions: SenderWithContext<PluginInstruction>, pub to_plugin: SenderWithContext<PluginInstruction>,
pub wasi_env: WasiEnv, pub wasi_env: WasiEnv,
pub subscriptions: Arc<Mutex<HashSet<EventType>>>, pub subscriptions: Arc<Mutex<HashSet<EventType>>>,
} }
@ -77,7 +77,7 @@ fn host_unsubscribe(plugin_env: &PluginEnv) {
fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) { fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) {
let selectable = selectable != 0; let selectable = selectable != 0;
plugin_env plugin_env
.send_screen_instructions .to_screen
.send(ScreenInstruction::SetSelectable( .send(ScreenInstruction::SetSelectable(
PaneId::Plugin(plugin_env.plugin_id), PaneId::Plugin(plugin_env.plugin_id),
selectable, selectable,
@ -88,7 +88,7 @@ fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) {
fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) { fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) {
let max_height = max_height as usize; let max_height = max_height as usize;
plugin_env plugin_env
.send_screen_instructions .to_screen
.send(ScreenInstruction::SetMaxHeight( .send(ScreenInstruction::SetMaxHeight(
PaneId::Plugin(plugin_env.plugin_id), PaneId::Plugin(plugin_env.plugin_id),
max_height, max_height,
@ -99,7 +99,7 @@ fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) {
fn host_set_invisible_borders(plugin_env: &PluginEnv, invisible_borders: i32) { fn host_set_invisible_borders(plugin_env: &PluginEnv, invisible_borders: i32) {
let invisible_borders = invisible_borders != 0; let invisible_borders = invisible_borders != 0;
plugin_env plugin_env
.send_screen_instructions .to_screen
.send(ScreenInstruction::SetInvisibleBorders( .send(ScreenInstruction::SetInvisibleBorders(
PaneId::Plugin(plugin_env.plugin_id), PaneId::Plugin(plugin_env.plugin_id),
invisible_borders, invisible_borders,
@ -118,7 +118,7 @@ fn host_get_plugin_ids(plugin_env: &PluginEnv) {
fn host_open_file(plugin_env: &PluginEnv) { fn host_open_file(plugin_env: &PluginEnv) {
let path: PathBuf = wasi_read_object(&plugin_env.wasi_env); let path: PathBuf = wasi_read_object(&plugin_env.wasi_env);
plugin_env plugin_env
.send_pty_instructions .to_pty
.send(PtyInstruction::SpawnTerminal(Some(path))) .send(PtyInstruction::SpawnTerminal(Some(path)))
.unwrap(); .unwrap();
} }
@ -133,7 +133,7 @@ fn host_set_timeout(plugin_env: &PluginEnv, secs: f64) {
// timers as we'd like. // timers as we'd like.
// //
// But that's a lot of code, and this is a few lines: // But that's a lot of code, and this is a few lines:
let send_plugin_instructions = plugin_env.send_plugin_instructions.clone(); let send_plugin_instructions = plugin_env.to_plugin.clone();
let update_target = Some(plugin_env.plugin_id); let update_target = Some(plugin_env.plugin_id);
thread::spawn(move || { thread::spawn(move || {
let start_time = Instant::now(); let start_time = Instant::now();