diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-03-05 21:13:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-05 21:13:02 +0100 |
| commit | 903cdf5d32476a8d6cc208d2c418a1f2c67e5a53 (patch) | |
| tree | 9a4647d9dc3efcdea8149fd78fdfa956b3c8d8cb /zellij-utils/src/plugin_api/event.rs | |
| parent | build: make test mirror build command for plugins (#4801) (diff) | |
| download | sl0ppij-903cdf5d32476a8d6cc208d2c418a1f2c67e5a53.tar.gz sl0ppij-903cdf5d32476a8d6cc208d2c418a1f2c67e5a53.tar.xz sl0ppij-903cdf5d32476a8d6cc208d2c418a1f2c67e5a53.zip | |
Click file paths to open in editor, allow plugins to change styles and hover of viewport (#4802)
* initial implementation
* implement hover
* add styles and foreground/background emphases, fix upsert hover collisions
* initial implementation of link plugin
* suppress highlighting + clicks on unfocused and mouse mode panes
* also make italic
* fix env var and ~ expansions
* fix regex issues and add defensive validations
* fix tests and add plugin assets
* add tests
* refactor all the things
* add pr
Diffstat (limited to 'zellij-utils/src/plugin_api/event.rs')
| -rw-r--r-- | zellij-utils/src/plugin_api/event.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/zellij-utils/src/plugin_api/event.rs b/zellij-utils/src/plugin_api/event.rs index 631d5069..267e1357 100644 --- a/zellij-utils/src/plugin_api/event.rs +++ b/zellij-utils/src/plugin_api/event.rs @@ -500,6 +500,26 @@ impl TryFrom<ProtobufEvent> for Event { }, _ => Err("Malformed payload for PluginConfigurationChanged Event"), }, + Some(ProtobufEventType::HighlightClicked) => match protobuf_event.payload { + Some(ProtobufEventPayload::HighlightClickedPayload(p)) => { + let pane_id = p + .pane_id + .ok_or("Missing pane_id in HighlightClicked")? + .try_into()?; + let context = p + .context + .into_iter() + .map(|item| (item.name, item.value)) + .collect(); + Ok(Event::HighlightClicked { + pane_id, + pattern: p.pattern, + matched_string: p.matched_string, + context, + }) + }, + _ => Err("Malformed payload for HighlightClicked Event"), + }, None => Err("Unknown Protobuf Event"), } } @@ -991,6 +1011,25 @@ impl TryFrom<Event> for ProtobufEvent { payload: Some(event::Payload::PluginConfigurationChangedPayload(payload)), }) }, + Event::HighlightClicked { + pane_id, + pattern, + matched_string, + context, + } => Ok(ProtobufEvent { + name: ProtobufEventType::HighlightClicked as i32, + payload: Some(event::Payload::HighlightClickedPayload( + HighlightClickedPayload { + pane_id: pane_id.try_into().ok(), + pattern, + matched_string, + context: context + .into_iter() + .map(|(name, value)| ProtobufContextItem { name, value }) + .collect(), + }, + )), + }), } } } @@ -1901,6 +1940,7 @@ impl TryFrom<ProtobufEventType> for EventType { ProtobufEventType::CwdChanged => EventType::CwdChanged, ProtobufEventType::AvailableLayoutInfo => EventType::AvailableLayoutInfo, ProtobufEventType::PluginConfigurationChanged => EventType::PluginConfigurationChanged, + ProtobufEventType::HighlightClicked => EventType::HighlightClicked, }) } } @@ -1950,6 +1990,7 @@ impl TryFrom<EventType> for ProtobufEventType { EventType::CwdChanged => ProtobufEventType::CwdChanged, EventType::AvailableLayoutInfo => ProtobufEventType::AvailableLayoutInfo, EventType::PluginConfigurationChanged => ProtobufEventType::PluginConfigurationChanged, + EventType::HighlightClicked => ProtobufEventType::HighlightClicked, }) } } |
