Make use_key_equivalents opt-in (#21662)

When revamping international keyboard shortcuts I wanted to make the
default to use key equivalents; in hindsight, this is not what people
expect.

Release Notes:

- (Breaking) In keymap.json `"use_layout_keys": true` is now the
default. If you want to opt-out of this behaviour, set
`"use_key_equivalents": true` to have keys mapped for your keyboard. See
[documentation](https://zed.dev/docs/key-bindings#non-qwerty-keyboards)

---------

Co-authored-by: Peter Tripp <peter@zed.dev>
This commit is contained in:
Conrad Irwin 2024-12-06 14:05:03 -07:00 committed by GitHub
parent 17448f23a6
commit 78ca297282
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 40 deletions

View file

@ -20,7 +20,7 @@ pub struct KeymapBlock {
#[serde(default)]
context: Option<String>,
#[serde(default)]
use_layout_keys: Option<bool>,
use_key_equivalents: Option<bool>,
bindings: BTreeMap<String, KeymapAction>,
}
@ -80,7 +80,7 @@ impl KeymapFile {
for KeymapBlock {
context,
use_layout_keys,
use_key_equivalents,
bindings,
} in self.0
{
@ -124,10 +124,10 @@ impl KeymapFile {
&keystroke,
action,
context.as_deref(),
if use_layout_keys.unwrap_or_default() {
None
} else {
if use_key_equivalents.unwrap_or_default() {
key_equivalents.as_ref()
} else {
None
},
)
})