diff options
author | Christian Duerr <contact@christianduerr.com> | 2021-04-03 23:52:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-03 23:52:44 +0000 |
commit | cbcc12944006603131119b73c2ad72ebccf4562d (patch) | |
tree | 3f323703c8ce47d1bf89c2e13f2c129b3e750683 /alacritty/src/config/ui_config.rs | |
parent | 531e494cf9a90de91dbbb84cb6cfc3158b78f1f2 (diff) | |
download | r-alacritty-cbcc12944006603131119b73c2ad72ebccf4562d.tar.gz r-alacritty-cbcc12944006603131119b73c2ad72ebccf4562d.tar.bz2 r-alacritty-cbcc12944006603131119b73c2ad72ebccf4562d.zip |
Add copy/paste/select hint actions
This adds some built-in actions for handling hint selections without
having to spawn external applications.
The new actions are `Copy`, `Select` and `Paste`.
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, |