diff options
| author | Aram Drevekenin <aram@poor.dev> | 2025-02-20 10:03:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-20 10:03:34 +0100 |
| commit | d1a45093455ecc1291a226fb9cbb1eacb35ac01a (patch) | |
| tree | e88ef9a7b5d20be6e995eb45029ff177666931d9 /zellij-utils/src/plugin_api | |
| parent | docs(changelog): resize shortcuts (diff) | |
| download | sl0ppij-d1a45093455ecc1291a226fb9cbb1eacb35ac01a.tar.gz sl0ppij-d1a45093455ecc1291a226fb9cbb1eacb35ac01a.tar.xz sl0ppij-d1a45093455ecc1291a226fb9cbb1eacb35ac01a.zip | |
fix(ux): some filepicker improvements (#4007)
* allow closing plugin pane after replacing it
* start of strider improvements
* improve strider's ux
* fix selected text ui component
* style(fmt): rustfmt
* style(fmt): rustfmt
Diffstat (limited to 'zellij-utils/src/plugin_api')
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.proto | 3 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.rs | 65 |
2 files changed, 43 insertions, 25 deletions
diff --git a/zellij-utils/src/plugin_api/plugin_command.proto b/zellij-utils/src/plugin_api/plugin_command.proto index e132909e..3fa321cc 100644 --- a/zellij-utils/src/plugin_api/plugin_command.proto +++ b/zellij-utils/src/plugin_api/plugin_command.proto @@ -243,6 +243,7 @@ message OpenFileInPlaceOfPluginPayload { file.File file_to_open = 1; optional FloatingPaneCoordinates floating_pane_coordinates = 2; repeated ContextItem context = 3; + bool close_plugin_after_replace = 4; } message OpenFileFloatingNearPluginPayload { @@ -260,6 +261,7 @@ message OpenFileNearPluginPayload { message OpenCommandPaneInPlaceOfPluginPayload { command.Command command_to_run = 1; repeated ContextItem context = 3; + bool close_plugin_after_replace = 4; } message OpenCommandPaneFloatingNearPluginPayload { @@ -271,6 +273,7 @@ message OpenCommandPaneFloatingNearPluginPayload { message OpenTerminalInPlaceOfPluginPayload { file.File file_to_open = 1; repeated ContextItem context = 3; + bool close_plugin_after_replace = 4; } message OpenTerminalFloatingNearPluginPayload { diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 1ec95d0f..0de590e7 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -1422,6 +1422,7 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand { )) => match open_terminal_in_place_of_plugin_payload.file_to_open { Some(file_to_open) => Ok(PluginCommand::OpenTerminalInPlaceOfPlugin( file_to_open.try_into()?, + open_terminal_in_place_of_plugin_payload.close_plugin_after_replace, )), None => Err("Malformed open terminal in place of plugin payload"), }, @@ -1467,6 +1468,8 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand { .collect(); Ok(PluginCommand::OpenCommandPaneInPlaceOfPlugin( command_to_run.try_into()?, + open_command_pane_in_place_of_plugin_payload + .close_plugin_after_replace, context, )) }, @@ -1528,6 +1531,7 @@ impl TryFrom<ProtobufPluginCommand> for PluginCommand { .collect(); Ok(PluginCommand::OpenFileInPlaceOfPlugin( file_to_open.try_into()?, + file_to_open_payload.close_plugin_after_replace, context, )) }, @@ -2467,16 +2471,23 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand { )), }) }, - PluginCommand::OpenTerminalInPlaceOfPlugin(cwd) => Ok(ProtobufPluginCommand { - name: CommandName::OpenTerminalInPlaceOfPlugin as i32, - payload: Some(Payload::OpenTerminalInPlaceOfPluginPayload( - OpenTerminalInPlaceOfPluginPayload { - file_to_open: Some(cwd.try_into()?), - context: vec![], // will be added in the future - }, - )), - }), - PluginCommand::OpenCommandPaneInPlaceOfPlugin(command_to_run, context) => { + PluginCommand::OpenTerminalInPlaceOfPlugin(cwd, close_plugin_after_replace) => { + Ok(ProtobufPluginCommand { + name: CommandName::OpenTerminalInPlaceOfPlugin as i32, + payload: Some(Payload::OpenTerminalInPlaceOfPluginPayload( + OpenTerminalInPlaceOfPluginPayload { + file_to_open: Some(cwd.try_into()?), + close_plugin_after_replace, + context: vec![], // will be added in the future + }, + )), + }) + }, + PluginCommand::OpenCommandPaneInPlaceOfPlugin( + command_to_run, + close_plugin_after_replace, + context, + ) => { let context: Vec<_> = context .into_iter() .map(|(name, value)| ContextItem { name, value }) @@ -2486,6 +2497,7 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand { payload: Some(Payload::OpenCommandPaneInPlaceOfPluginPayload( OpenCommandPaneInPlaceOfPluginPayload { command_to_run: Some(command_to_run.try_into()?), + close_plugin_after_replace, context, }, )), @@ -2521,21 +2533,24 @@ impl TryFrom<PluginCommand> for ProtobufPluginCommand { }, )), }), - PluginCommand::OpenFileInPlaceOfPlugin(file_to_open, context) => { - Ok(ProtobufPluginCommand { - name: CommandName::OpenFileInPlaceOfPlugin as i32, - payload: Some(Payload::OpenFileInPlaceOfPluginPayload( - OpenFileInPlaceOfPluginPayload { - file_to_open: Some(file_to_open.try_into()?), - floating_pane_coordinates: None, - context: context - .into_iter() - .map(|(name, value)| ContextItem { name, value }) - .collect(), - }, - )), - }) - }, + PluginCommand::OpenFileInPlaceOfPlugin( + file_to_open, + close_plugin_after_replace, + context, + ) => Ok(ProtobufPluginCommand { + name: CommandName::OpenFileInPlaceOfPlugin as i32, + payload: Some(Payload::OpenFileInPlaceOfPluginPayload( + OpenFileInPlaceOfPluginPayload { + file_to_open: Some(file_to_open.try_into()?), + floating_pane_coordinates: None, + close_plugin_after_replace, + context: context + .into_iter() + .map(|(name, value)| ContextItem { name, value }) + .collect(), + }, + )), + }), } } } |
