Add a basic tab keybinding

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-05-11 17:10:37 +02:00
parent e076c2c6dc
commit e72a309734
2 changed files with 3 additions and 0 deletions

View file

@ -15,6 +15,7 @@ use std::{ffi::CStr, os::raw::c_char};
const BACKSPACE_KEY: u16 = 0x7f;
const ENTER_KEY: u16 = 0x0d;
const ESCAPE_KEY: u16 = 0x1b;
const TAB_KEY: u16 = 0x09;
impl Event {
pub unsafe fn from_native(native_event: id, window_height: Option<f32>) -> Option<Self> {
@ -49,6 +50,7 @@ impl Event {
ENTER_KEY => "enter",
DELETE_KEY => "delete",
ESCAPE_KEY => "escape",
TAB_KEY => "tab",
_ => unmodified_chars,
}
} else {

View file

@ -36,6 +36,7 @@ pub fn init(app: &mut MutableAppContext) {
Binding::new("delete", "buffer:delete", Some("BufferView")),
Binding::new("ctrl-d", "buffer:delete", 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(
"alt-backspace",