aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/config/mod.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_terminal/src/config/mod.rs
parent64db7d3daaed4e06fb8292227622bbc4cdaa2cf0 (diff)
downloadalacritty-1a8cd172e520e493bacc9c6a2ae6f80de086eaa3.tar.gz
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_terminal/src/config/mod.rs')
-rw-r--r--alacritty_terminal/src/config/mod.rs32
1 files changed, 20 insertions, 12 deletions
diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs
index da95391c..df8d37bd 100644
--- a/alacritty_terminal/src/config/mod.rs
+++ b/alacritty_terminal/src/config/mod.rs
@@ -28,7 +28,7 @@ mod scrolling;
mod visual_bell;
mod window;
-use crate::ansi::{Color, CursorStyle, NamedColor};
+use crate::ansi::{CursorStyle, NamedColor};
pub use crate::config::colors::Colors;
pub use crate::config::debug::Debug;
@@ -170,16 +170,28 @@ impl<T> Config<T> {
self.dynamic_title.0
}
- /// Cursor foreground color
+ /// Cursor foreground color.
#[inline]
pub fn cursor_text_color(&self) -> Option<Rgb> {
self.colors.cursor.text
}
- /// Cursor background color
+ /// Cursor background color.
#[inline]
- pub fn cursor_cursor_color(&self) -> Option<Color> {
- self.colors.cursor.cursor.map(|_| Color::Named(NamedColor::Cursor))
+ pub fn cursor_cursor_color(&self) -> Option<NamedColor> {
+ self.colors.cursor.cursor.map(|_| NamedColor::Cursor)
+ }
+
+ /// Vi mode cursor foreground color.
+ #[inline]
+ pub fn vi_mode_cursor_text_color(&self) -> Option<Rgb> {
+ self.colors.vi_mode_cursor.text
+ }
+
+ /// Vi mode cursor background color.
+ #[inline]
+ pub fn vi_mode_cursor_cursor_color(&self) -> Option<Rgb> {
+ self.colors.vi_mode_cursor.cursor
}
#[inline]
@@ -230,20 +242,16 @@ impl Default for EscapeChars {
}
#[serde(default)]
-#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq)]
+#[derive(Deserialize, Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct Cursor {
#[serde(deserialize_with = "failure_default")]
pub style: CursorStyle,
+ #[serde(deserialize_with = "option_explicit_none")]
+ pub vi_mode_style: Option<CursorStyle>,
#[serde(deserialize_with = "failure_default")]
unfocused_hollow: DefaultTrueBool,
}
-impl Default for Cursor {
- fn default() -> Self {
- Self { style: Default::default(), unfocused_hollow: Default::default() }
- }
-}
-
impl Cursor {
pub fn unfocused_hollow(self) -> bool {
self.unfocused_hollow.0