aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-07-20 17:42:47 +0000
committerGitHub <noreply@github.com>2023-07-20 17:42:47 +0000
commit2101d5ac37d65114781a84b889d96eafe768860a (patch)
treebcce739b4ec65e6676d3c0156676435f8fd15a0b
parentbf671412cef2e99d0c2ee3d0350dc4576fb63725 (diff)
downloadalacritty-2101d5ac37d65114781a84b889d96eafe768860a.tar.gz
alacritty-2101d5ac37d65114781a84b889d96eafe768860a.zip
Fix keys like `+` not working on neo layouts
The key_without_modifier removes all the modifiers including the multiple shift levels, which is not desired. In alacritty we just wanted to treat uppercase and lowercase latters the same, which we can with the help of builtin functions.
-rw-r--r--alacritty/src/config/bindings.rs6
-rw-r--r--alacritty/src/input.rs9
-rw-r--r--extra/man/alacritty-bindings.5.scd6
3 files changed, 11 insertions, 10 deletions
diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs
index 1ca5e415..5a2ca7ec 100644
--- a/alacritty/src/config/bindings.rs
+++ b/alacritty/src/config/bindings.rs
@@ -463,8 +463,8 @@ pub fn default_key_bindings() -> Vec<KeyBinding> {
ArrowLeft, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Left;
ArrowRight, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Right;
"0", +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::First;
- "4", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Last;
- "6", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::FirstOccupied;
+ "$", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Last;
+ "^", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::FirstOccupied;
"h", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::High;
"m", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Middle;
"l", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Low;
@@ -474,7 +474,7 @@ pub fn default_key_bindings() -> Vec<KeyBinding> {
"b", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::WordLeft;
"w", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::WordRight;
"e", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::WordRightEnd;
- "5", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Bracket;
+ "%", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Bracket;
Enter, +BindingMode::VI, +BindingMode::SEARCH; SearchAction::SearchConfirm;
// Plain search.
Escape, +BindingMode::SEARCH; SearchAction::SearchCancel;
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index 19996c72..a8fb09b5 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -1050,10 +1050,11 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
for i in 0..self.ctx.config().key_bindings().len() {
let binding = &self.ctx.config().key_bindings()[i];
- // When the logical key is some named key, use it, otherwise fallback to
- // key without modifiers to account for bindings.
- let logical_key = if matches!(key.logical_key, Key::Character(_)) {
- key.key_without_modifiers()
+ // We don't want the key without modifier, because it means something else most of
+ // the time. However what we want is to manually lowercase the character to account
+ // for both small and capital latters on regular characters at the same time.
+ let logical_key = if let Key::Character(ch) = key.logical_key.as_ref() {
+ Key::Character(ch.to_lowercase().into())
} else {
key.logical_key.clone()
};
diff --git a/extra/man/alacritty-bindings.5.scd b/extra/man/alacritty-bindings.5.scd
index ddd4a6ea..6ad98680 100644
--- a/extra/man/alacritty-bindings.5.scd
+++ b/extra/man/alacritty-bindings.5.scd
@@ -197,11 +197,11 @@ configuration. See *alacritty*(5) for full configuration format documentation.
:[
: _"Vi|~Search"_
: _"First"_
-| _"4"_
+| _"$"_
: _"Shift"_
: _"Vi|~Search"_
: _"Last"_
-| _"6"_
+| _"^"_
: _"Shift"_
: _"Vi|~Search"_
: _"FirstOccupied"_
@@ -241,7 +241,7 @@ configuration. See *alacritty*(5) for full configuration format documentation.
: _"Shift"_
: _"Vi|~Search"_
: _"WordRightEnd"_
-| _"5"_
+| _"%"_
: _"Shift"_
: _"Vi|~Search"_
: _"Bracket"_