diff options
Diffstat (limited to 'alacritty/src/config/ui_config.rs')
-rw-r--r-- | alacritty/src/config/ui_config.rs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs index 6d06aa7d..3cd2ad88 100644 --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -4,7 +4,7 @@ use std::rc::Rc; use log::error; use serde::de::Error as SerdeError; -use serde::{Deserialize, Deserializer}; +use serde::{self, Deserialize, Deserializer}; use unicode_width::UnicodeWidthChar; use alacritty_config_derive::ConfigDeserialize; @@ -245,11 +245,35 @@ impl<'de> Deserialize<'de> for HintsAlphabet { } } +/// Built-in actions for hint mode. +#[derive(ConfigDeserialize, Clone, Debug, PartialEq, Eq)] +pub enum HintInternalAction { + /// Copy the text to the clipboard. + Copy, + /// Write the text to the PTY/search. + Paste, + /// Select the text matching the hint. + Select, +} + +/// Actions for hint bindings. +#[derive(Deserialize, Clone, Debug, PartialEq, Eq)] +pub enum HintAction { + /// Built-in hint action. + #[serde(rename = "action")] + Action(HintInternalAction), + + /// Command the text will be piped to. + #[serde(rename = "command")] + Command(Program), +} + /// Hint configuration. #[derive(Deserialize, Clone, Debug, PartialEq, Eq)] pub struct Hint { - /// Command the text will be piped to. - pub command: Program, + /// Action executed when this hint is triggered. + #[serde(flatten)] + pub action: HintAction, /// Regex for finding matches. pub regex: LazyRegex, |