fix(plugins): cwd and usability fixes (#3749)
* fix(plugins): maintain cwd between plugin reloads * fix(plugin-manager): default to loading plugins in the foreground and allow sending space in configuration
This commit is contained in:
parent
54b309bdb8
commit
452effab8f
3 changed files with 10 additions and 10 deletions
|
|
@ -49,7 +49,7 @@ impl Default for NewPluginScreen {
|
||||||
entering_config_val: false,
|
entering_config_val: false,
|
||||||
selected_config_index: None,
|
selected_config_index: None,
|
||||||
request_ids: vec![],
|
request_ids: vec![],
|
||||||
load_in_background: true,
|
load_in_background: false,
|
||||||
colors: Palette::default(),
|
colors: Palette::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -353,7 +353,7 @@ impl NewPluginScreen {
|
||||||
let (mut should_render, mut should_close) = (false, false);
|
let (mut should_render, mut should_close) = (false, false);
|
||||||
|
|
||||||
match key.bare_key {
|
match key.bare_key {
|
||||||
BareKey::Char(character) if key.has_no_modifiers() && character != ' ' => {
|
BareKey::Char(character) if key.has_no_modifiers() => {
|
||||||
if let Some(field) = self.get_field_being_edited_mut() {
|
if let Some(field) = self.get_field_being_edited_mut() {
|
||||||
field.push(character);
|
field.push(character);
|
||||||
}
|
}
|
||||||
|
|
@ -965,7 +965,7 @@ impl State {
|
||||||
pub fn handle_main_screen_key(&mut self, key: KeyWithModifier) -> bool {
|
pub fn handle_main_screen_key(&mut self, key: KeyWithModifier) -> bool {
|
||||||
let mut should_render = false;
|
let mut should_render = false;
|
||||||
match key.bare_key {
|
match key.bare_key {
|
||||||
BareKey::Char(character) if key.has_no_modifiers() && character != ' ' => {
|
BareKey::Char(character) if key.has_no_modifiers() => {
|
||||||
self.search_term.push(character);
|
self.search_term.push(character);
|
||||||
self.update_search_term();
|
self.update_search_term();
|
||||||
self.reset_selection();
|
self.reset_selection();
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ impl<'a> PluginLoader<'a> {
|
||||||
engine,
|
engine,
|
||||||
&plugin_dir,
|
&plugin_dir,
|
||||||
path_to_default_shell,
|
path_to_default_shell,
|
||||||
zellij_cwd,
|
Some(zellij_cwd),
|
||||||
capabilities,
|
capabilities,
|
||||||
client_attributes,
|
client_attributes,
|
||||||
default_shell,
|
default_shell,
|
||||||
|
|
@ -275,7 +275,6 @@ impl<'a> PluginLoader<'a> {
|
||||||
connected_clients: Arc<Mutex<Vec<ClientId>>>,
|
connected_clients: Arc<Mutex<Vec<ClientId>>>,
|
||||||
loading_indication: &mut LoadingIndication,
|
loading_indication: &mut LoadingIndication,
|
||||||
path_to_default_shell: PathBuf,
|
path_to_default_shell: PathBuf,
|
||||||
zellij_cwd: PathBuf,
|
|
||||||
capabilities: PluginCapabilities,
|
capabilities: PluginCapabilities,
|
||||||
client_attributes: ClientAttributes,
|
client_attributes: ClientAttributes,
|
||||||
default_shell: Option<TerminalAction>,
|
default_shell: Option<TerminalAction>,
|
||||||
|
|
@ -301,7 +300,7 @@ impl<'a> PluginLoader<'a> {
|
||||||
engine,
|
engine,
|
||||||
&plugin_dir,
|
&plugin_dir,
|
||||||
path_to_default_shell,
|
path_to_default_shell,
|
||||||
zellij_cwd,
|
None,
|
||||||
capabilities,
|
capabilities,
|
||||||
client_attributes,
|
client_attributes,
|
||||||
default_shell,
|
default_shell,
|
||||||
|
|
@ -382,7 +381,7 @@ impl<'a> PluginLoader<'a> {
|
||||||
engine: Engine,
|
engine: Engine,
|
||||||
plugin_dir: &'a PathBuf,
|
plugin_dir: &'a PathBuf,
|
||||||
path_to_default_shell: PathBuf,
|
path_to_default_shell: PathBuf,
|
||||||
zellij_cwd: PathBuf,
|
cwd: Option<PathBuf>,
|
||||||
capabilities: PluginCapabilities,
|
capabilities: PluginCapabilities,
|
||||||
client_attributes: ClientAttributes,
|
client_attributes: ClientAttributes,
|
||||||
default_shell: Option<TerminalAction>,
|
default_shell: Option<TerminalAction>,
|
||||||
|
|
@ -405,6 +404,10 @@ impl<'a> PluginLoader<'a> {
|
||||||
let keybinds = running_plugin.store.data().keybinds.clone();
|
let keybinds = running_plugin.store.data().keybinds.clone();
|
||||||
let default_mode = running_plugin.store.data().default_mode;
|
let default_mode = running_plugin.store.data().default_mode;
|
||||||
let plugin_config = running_plugin.store.data().plugin.clone();
|
let plugin_config = running_plugin.store.data().plugin.clone();
|
||||||
|
// prefer the explicitly given cwd, otherwise copy it from the running plugin
|
||||||
|
// (when reloading a plugin, we want to copy it, when starting a new plugin instance from
|
||||||
|
// meomory, we want to reset it)
|
||||||
|
let zellij_cwd = cwd.unwrap_or_else(|| running_plugin.store.data().plugin_cwd.clone());
|
||||||
loading_indication.set_name(running_plugin.store.data().name());
|
loading_indication.set_name(running_plugin.store.data().name());
|
||||||
PluginLoader::new(
|
PluginLoader::new(
|
||||||
plugin_cache,
|
plugin_cache,
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,6 @@ impl WasmBridge {
|
||||||
let plugin_map = self.plugin_map.clone();
|
let plugin_map = self.plugin_map.clone();
|
||||||
let connected_clients = self.connected_clients.clone();
|
let connected_clients = self.connected_clients.clone();
|
||||||
let path_to_default_shell = self.path_to_default_shell.clone();
|
let path_to_default_shell = self.path_to_default_shell.clone();
|
||||||
let zellij_cwd = self.zellij_cwd.clone();
|
|
||||||
let capabilities = self.capabilities.clone();
|
let capabilities = self.capabilities.clone();
|
||||||
let client_attributes = self.client_attributes.clone();
|
let client_attributes = self.client_attributes.clone();
|
||||||
let default_shell = self.default_shell.clone();
|
let default_shell = self.default_shell.clone();
|
||||||
|
|
@ -380,7 +379,6 @@ impl WasmBridge {
|
||||||
connected_clients.clone(),
|
connected_clients.clone(),
|
||||||
&mut loading_indication,
|
&mut loading_indication,
|
||||||
path_to_default_shell.clone(),
|
path_to_default_shell.clone(),
|
||||||
zellij_cwd.clone(),
|
|
||||||
capabilities.clone(),
|
capabilities.clone(),
|
||||||
client_attributes.clone(),
|
client_attributes.clone(),
|
||||||
default_shell.clone(),
|
default_shell.clone(),
|
||||||
|
|
@ -456,7 +454,6 @@ impl WasmBridge {
|
||||||
connected_clients.clone(),
|
connected_clients.clone(),
|
||||||
&mut loading_indication,
|
&mut loading_indication,
|
||||||
path_to_default_shell.clone(),
|
path_to_default_shell.clone(),
|
||||||
zellij_cwd.clone(),
|
|
||||||
capabilities.clone(),
|
capabilities.clone(),
|
||||||
client_attributes.clone(),
|
client_attributes.clone(),
|
||||||
default_shell.clone(),
|
default_shell.clone(),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue