diff options
author | Christian Duerr <contact@christianduerr.com> | 2021-05-10 21:20:09 +0000 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2021-05-10 21:34:38 +0000 |
commit | 939b0c548ae534f79ad29cfa60cd6653c49514e2 (patch) | |
tree | 61a494f6a88f927df253f9d663dc641412f76f31 | |
parent | d0ab81bf3f8c26423435a0217264faf14aecbb12 (diff) | |
download | alacritty-939b0c548ae534f79ad29cfa60cd6653c49514e2.tar.gz alacritty-939b0c548ae534f79ad29cfa60cd6653c49514e2.zip |
Fix default URL binding
The default binding for launching the URL hints was documented as
Ctrl+Shift+U, but never actually set. This adds this binding as the
default instead of having URLs only launchable using the mouse.
-rw-r--r-- | alacritty/src/config/mod.rs | 18 | ||||
-rw-r--r-- | alacritty/src/config/ui_config.rs | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs index 4ddc81c2..e2476bb2 100644 --- a/alacritty/src/config/mod.rs +++ b/alacritty/src/config/mod.rs @@ -118,8 +118,7 @@ pub fn load(options: &Options) -> Config { config }); - // Override config with CLI options. - options.override_config(&mut config); + after_loading(&mut config, options); config } @@ -130,12 +129,20 @@ pub fn reload(config_path: &Path, options: &Options) -> Result<Config> { let config_options = options.config_options().clone(); let mut config = load_from(config_path, config_options)?; - // Override config with CLI options. - options.override_config(&mut config); + after_loading(&mut config, options); Ok(config) } +/// Modifications after the `Config` object is created. +fn after_loading(config: &mut Config, options: &Options) { + // Override config with CLI options. + options.override_config(config); + + // Create key bindings for regex hints. + config.ui_config.generate_hint_bindings(); +} + /// Load configuration file and log errors. fn load_from(path: &Path, cli_config: Value) -> Result<Config> { match read_config(path, cli_config) { @@ -159,9 +166,6 @@ fn read_config(path: &Path, cli_config: Value) -> Result<Config> { let mut config = Config::deserialize(config_value)?; config.ui_config.config_paths = config_paths; - // Create key bindings for regex hints. - config.ui_config.generate_hint_bindings(); - Ok(config) } diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs index d34389e9..d1f16f85 100644 --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -2,6 +2,7 @@ use std::cell::RefCell; use std::path::PathBuf; use std::rc::Rc; +use glutin::event::{ModifiersState, VirtualKeyCode}; use log::error; use serde::de::Error as SerdeError; use serde::{self, Deserialize, Deserializer}; @@ -238,7 +239,10 @@ impl Default for Hints { action, post_processing: true, mouse: Some(HintMouse { enabled: true, mods: Default::default() }), - binding: Default::default(), + binding: Some(HintBinding { + key: Key::Keycode(VirtualKeyCode::U), + mods: ModsWrapper(ModifiersState::SHIFT | ModifiersState::CTRL), + }), }], alphabet: Default::default(), } |