aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/config/ui_config.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-03-18 02:35:08 +0000
committerGitHub <noreply@github.com>2020-03-18 02:35:08 +0000
commit1a8cd172e520e493bacc9c6a2ae6f80de086eaa3 (patch)
tree0b837f1f52f72fe00e258afc34094d60b5d18f04 /alacritty/src/config/ui_config.rs
parent64db7d3daaed4e06fb8292227622bbc4cdaa2cf0 (diff)
downloadr-alacritty-1a8cd172e520e493bacc9c6a2ae6f80de086eaa3.tar.gz
r-alacritty-1a8cd172e520e493bacc9c6a2ae6f80de086eaa3.tar.bz2
r-alacritty-1a8cd172e520e493bacc9c6a2ae6f80de086eaa3.zip
Add modal keyboard motion mode
This implements a basic mode for navigating inside of Alacritty's history with keyboard bindings. They're bound by default to vi's motion shortcuts but are fully customizable. Since this relies on key bindings only single key bindings are currently supported (so no `ge`, or repetition). Other than navigating the history and moving the viewport, this mode should enable making use of all available selection modes to copy content to the clipboard and launch URLs below the cursor. This also changes the rendering of the block cursor at the side of selections, since previously it could be inverted to be completely invisible. Since that would have caused some troubles with this keyboard selection mode, the block cursor now is no longer inverted when it is at the edges of a selection. Fixes #262.
Diffstat (limited to 'alacritty/src/config/ui_config.rs')
-rw-r--r--alacritty/src/config/ui_config.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs
index d7a477a0..13a3b04e 100644
--- a/alacritty/src/config/ui_config.rs
+++ b/alacritty/src/config/ui_config.rs
@@ -1,6 +1,7 @@
+use log::error;
use serde::{Deserialize, Deserializer};
-use alacritty_terminal::config::failure_default;
+use alacritty_terminal::config::{failure_default, LOG_TARGET_CONFIG};
use crate::config::bindings::{self, Binding, KeyBinding, MouseBinding};
use crate::config::mouse::Mouse;
@@ -60,7 +61,18 @@ where
T: Copy + Eq,
Binding<T>: Deserialize<'a>,
{
- let mut bindings: Vec<Binding<T>> = failure_default(deserializer)?;
+ let values = Vec::<serde_yaml::Value>::deserialize(deserializer)?;
+
+ // Skip all invalid values
+ let mut bindings = Vec::with_capacity(values.len());
+ for value in values {
+ match Binding::<T>::deserialize(value) {
+ Ok(binding) => bindings.push(binding),
+ Err(err) => {
+ error!(target: LOG_TARGET_CONFIG, "Problem with config: {}; ignoring binding", err);
+ },
+ }
+ }
// Remove matching default bindings
for binding in bindings.iter() {