aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/plugin_api
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-07-05 15:13:51 +0200
committerGitHub <noreply@github.com>2024-07-05 15:13:51 +0200
commita6d6c0e4ff03c35cafb6f04363ecab856ee3682d (patch)
treeeadf1c24c4c6a1e4b7499b3cd047351fd29e52de /zellij-utils/src/plugin_api
parentdocs(changelog): wasmer -> wasmtime (diff)
downloadsl0ppij-a6d6c0e4ff03c35cafb6f04363ecab856ee3682d.tar.gz
sl0ppij-a6d6c0e4ff03c35cafb6f04363ecab856ee3682d.tar.xz
sl0ppij-a6d6c0e4ff03c35cafb6f04363ecab856ee3682d.zip
feat(ui): status bar redesign (#3475)
* work * work * working * get default mode from server and some ui responsiveness * work * finish design and get tests to pass * get e2e tests to pass * add classic layout * add classic layout assets * fix e2e tests * style(fmt): rustfmt * fix plugin system test * style(fmt): some cleanups
Diffstat (limited to 'zellij-utils/src/plugin_api')
-rw-r--r--zellij-utils/src/plugin_api/event.proto1
-rw-r--r--zellij-utils/src/plugin_api/event.rs9
2 files changed, 10 insertions, 0 deletions
diff --git a/zellij-utils/src/plugin_api/event.proto b/zellij-utils/src/plugin_api/event.proto
index abc239c0..c48030aa 100644
--- a/zellij-utils/src/plugin_api/event.proto
+++ b/zellij-utils/src/plugin_api/event.proto
@@ -218,6 +218,7 @@ message ModeUpdatePayload {
style.Style style = 3;
bool arrow_fonts_support = 4;
optional string session_name = 5;
+ optional input_mode.InputMode base_mode = 6;
}
message InputModeKeybinds {
diff --git a/zellij-utils/src/plugin_api/event.rs b/zellij-utils/src/plugin_api/event.rs
index e8966533..1e793e66 100644
--- a/zellij-utils/src/plugin_api/event.rs
+++ b/zellij-utils/src/plugin_api/event.rs
@@ -813,6 +813,9 @@ impl TryFrom<ProtobufModeUpdatePayload> for ModeInfo {
ProtobufInputMode::from_i32(protobuf_mode_update_payload.current_mode)
.ok_or("Malformed InputMode in the ModeUpdate Event")?
.try_into()?;
+ let base_mode: Option<InputMode> = protobuf_mode_update_payload
+ .base_mode
+ .and_then(|b_m| ProtobufInputMode::from_i32(b_m)?.try_into().ok());
let keybinds: Vec<(InputMode, Vec<(KeyWithModifier, Vec<Action>)>)> =
protobuf_mode_update_payload
.keybinds
@@ -851,6 +854,7 @@ impl TryFrom<ProtobufModeUpdatePayload> for ModeInfo {
style,
capabilities,
session_name,
+ base_mode,
};
Ok(mode_info)
}
@@ -860,6 +864,9 @@ impl TryFrom<ModeInfo> for ProtobufModeUpdatePayload {
type Error = &'static str;
fn try_from(mode_info: ModeInfo) -> Result<Self, &'static str> {
let current_mode: ProtobufInputMode = mode_info.mode.try_into()?;
+ let base_mode: Option<ProtobufInputMode> = mode_info
+ .base_mode
+ .and_then(|mode| ProtobufInputMode::try_from(mode).ok());
let style: ProtobufStyle = mode_info.style.try_into()?;
let arrow_fonts_support: bool = mode_info.capabilities.arrow_fonts;
let session_name = mode_info.session_name;
@@ -893,6 +900,7 @@ impl TryFrom<ModeInfo> for ProtobufModeUpdatePayload {
keybinds: protobuf_input_mode_keybinds,
arrow_fonts_support,
session_name,
+ base_mode: base_mode.map(|b_m| b_m as i32),
})
}
}
@@ -1112,6 +1120,7 @@ fn serialize_mode_update_event_with_non_default_values() {
},
capabilities: PluginCapabilities { arrow_fonts: false },
session_name: Some("my awesome test session".to_owned()),
+ base_mode: Some(InputMode::Locked),
});
let protobuf_event: ProtobufEvent = mode_update_event.clone().try_into().unwrap();
let serialized_protobuf_event = protobuf_event.encode_to_vec();