Add a basic tab keybinding
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
parent
e076c2c6dc
commit
e72a309734
@@ -15,6 +15,7 @@ use std::{ffi::CStr, os::raw::c_char};
|
|||||||
const BACKSPACE_KEY: u16 = 0x7f;
|
const BACKSPACE_KEY: u16 = 0x7f;
|
||||||
const ENTER_KEY: u16 = 0x0d;
|
const ENTER_KEY: u16 = 0x0d;
|
||||||
const ESCAPE_KEY: u16 = 0x1b;
|
const ESCAPE_KEY: u16 = 0x1b;
|
||||||
|
const TAB_KEY: u16 = 0x09;
|
||||||
|
|
||||||
impl Event {
|
impl Event {
|
||||||
pub unsafe fn from_native(native_event: id, window_height: Option<f32>) -> Option<Self> {
|
pub unsafe fn from_native(native_event: id, window_height: Option<f32>) -> Option<Self> {
|
||||||
@@ -49,6 +50,7 @@ impl Event {
|
|||||||
ENTER_KEY => "enter",
|
ENTER_KEY => "enter",
|
||||||
DELETE_KEY => "delete",
|
DELETE_KEY => "delete",
|
||||||
ESCAPE_KEY => "escape",
|
ESCAPE_KEY => "escape",
|
||||||
|
TAB_KEY => "tab",
|
||||||
_ => unmodified_chars,
|
_ => unmodified_chars,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ pub fn init(app: &mut MutableAppContext) {
|
|||||||
Binding::new("delete", "buffer:delete", Some("BufferView")),
|
Binding::new("delete", "buffer:delete", Some("BufferView")),
|
||||||
Binding::new("ctrl-d", "buffer:delete", Some("BufferView")),
|
Binding::new("ctrl-d", "buffer:delete", Some("BufferView")),
|
||||||
Binding::new("enter", "buffer:newline", Some("BufferView")),
|
Binding::new("enter", "buffer:newline", Some("BufferView")),
|
||||||
|
Binding::new("tab", "buffer:insert", Some("BufferView")).with_arg("\t".to_string()),
|
||||||
Binding::new("ctrl-shift-K", "buffer:delete_line", Some("BufferView")),
|
Binding::new("ctrl-shift-K", "buffer:delete_line", Some("BufferView")),
|
||||||
Binding::new(
|
Binding::new(
|
||||||
"alt-backspace",
|
"alt-backspace",
|
||||||
|
|||||||
Reference in New Issue
Block a user