implement keybinding actions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use gpui::{App, Window};
|
||||
use gpui::{App, AppContext, Window};
|
||||
|
||||
/// The key context used for input element keybindings.
|
||||
pub const DEFAULT_INPUT_CONTEXT: &str = "Input";
|
||||
@@ -142,70 +142,94 @@ pub fn default_bindings() -> gpui::ActionBindingCollection {
|
||||
bindings
|
||||
}
|
||||
|
||||
pub trait EditableTextActionHandler {
|
||||
fn escape(&mut self, _: &Escape, _w: &mut Window, _cx: &mut App) {}
|
||||
pub trait EditableTextActionHandler<'app>: Sized {
|
||||
type Context: AppContext;
|
||||
|
||||
fn insert_enter(&mut self, _: &Enter, _w: &mut Window, _cx: &mut App) {}
|
||||
fn insert_tab(&mut self, _: &Tab, _w: &mut Window, _cx: &mut App) {}
|
||||
fn escape(&mut self, _: &Escape, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
|
||||
fn backspace(&mut self, _: &Backspace, _w: &mut Window, _cx: &mut App) {}
|
||||
fn delete(&mut self, _: &Delete, _w: &mut Window, _cx: &mut App) {}
|
||||
fn insert_enter(&mut self, _: &Enter, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn insert_tab(&mut self, _: &Tab, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
|
||||
fn delete_word_left(&mut self, _: &DeleteWordLeft, _w: &mut Window, _cx: &mut App) {}
|
||||
fn delete_word_right(&mut self, _: &DeleteWordRight, _w: &mut Window, _cx: &mut App) {}
|
||||
fn backspace(&mut self, _: &Backspace, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn delete(&mut self, _: &Delete, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
|
||||
fn delete_word_left(&mut self, _: &DeleteWordLeft, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn delete_word_right(&mut self, _: &DeleteWordRight, _w: &mut Window, _cx: &mut Self::Context) {
|
||||
}
|
||||
fn delete_to_line_start(
|
||||
&mut self,
|
||||
_: &DeleteToBeginningOfLine,
|
||||
_w: &mut Window,
|
||||
_cx: &mut App,
|
||||
_cx: &mut Self::Context,
|
||||
) {
|
||||
}
|
||||
fn delete_to_line_end(
|
||||
&mut self,
|
||||
_: &DeleteToEndOfLine,
|
||||
_w: &mut Window,
|
||||
_cx: &mut Self::Context,
|
||||
) {
|
||||
}
|
||||
fn delete_to_line_end(&mut self, _: &DeleteToEndOfLine, _w: &mut Window, _cx: &mut App) {}
|
||||
|
||||
fn nav_left(&mut self, _: &Left, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_right(&mut self, _: &Right, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_up(&mut self, _: &Up, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_down(&mut self, _: &Down, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_line_start(&mut self, _: &Home, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_line_end(&mut self, _: &End, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_start(&mut self, _: &MoveToBeginning, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_end(&mut self, _: &MoveToEnd, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_left_word(&mut self, _: &WordLeft, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_right_word(&mut self, _: &WordRight, _w: &mut Window, _cx: &mut App) {}
|
||||
fn nav_left(&mut self, _: &Left, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_right(&mut self, _: &Right, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_up(&mut self, _: &Up, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_down(&mut self, _: &Down, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_line_start(&mut self, _: &Home, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_line_end(&mut self, _: &End, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_start(&mut self, _: &MoveToBeginning, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_end(&mut self, _: &MoveToEnd, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_left_word(&mut self, _: &WordLeft, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn nav_right_word(&mut self, _: &WordRight, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
|
||||
fn select_all(&mut self, _: &SelectAll, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_left(&mut self, _: &SelectLeft, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_right(&mut self, _: &SelectRight, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_up(&mut self, _: &SelectUp, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_down(&mut self, _: &SelectDown, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_start(&mut self, _: &SelectToBeginning, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_end(&mut self, _: &SelectToEnd, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_left_word(&mut self, _: &SelectWordLeft, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_right_word(&mut self, _: &SelectWordRight, _w: &mut Window, _cx: &mut App) {}
|
||||
fn select_all(&mut self, _: &SelectAll, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_left(&mut self, _: &SelectLeft, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_right(&mut self, _: &SelectRight, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_up(&mut self, _: &SelectUp, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_down(&mut self, _: &SelectDown, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_start(&mut self, _: &SelectToBeginning, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_end(&mut self, _: &SelectToEnd, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_left_word(&mut self, _: &SelectWordLeft, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn select_right_word(&mut self, _: &SelectWordRight, _w: &mut Window, _cx: &mut Self::Context) {
|
||||
}
|
||||
|
||||
fn cut(&mut self, _: &Cut, _w: &mut Window, _cx: &mut App) {}
|
||||
fn copy(&mut self, _: &Copy, _w: &mut Window, _cx: &mut App) {}
|
||||
fn paste(&mut self, _: &Paste, _w: &mut Window, _cx: &mut App) {}
|
||||
fn cut(&mut self, _: &Cut, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn copy(&mut self, _: &Copy, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn paste(&mut self, _: &Paste, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
|
||||
fn undo(&mut self, _: &Undo, _w: &mut Window, _cx: &mut App) {}
|
||||
fn redo(&mut self, _: &Redo, _w: &mut Window, _cx: &mut App) {}
|
||||
fn undo(&mut self, _: &Undo, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
fn redo(&mut self, _: &Redo, _w: &mut Window, _cx: &mut Self::Context) {}
|
||||
|
||||
fn show_character_palette(
|
||||
&mut self,
|
||||
_: &ShowCharacterPalette,
|
||||
window: &mut Window,
|
||||
_cx: &mut App,
|
||||
_cx: &mut Self::Context,
|
||||
) {
|
||||
window.show_character_palette();
|
||||
}
|
||||
|
||||
fn on_mouse_down(
|
||||
&mut self,
|
||||
_position: gpui::Point<gpui::Pixels>,
|
||||
_event: &gpui::MouseDownEvent,
|
||||
_text_position: gpui::Point<gpui::Pixels>,
|
||||
_w: &mut Window,
|
||||
_cx: &mut App,
|
||||
_cx: &mut Self::Context,
|
||||
) {
|
||||
}
|
||||
fn on_mouse_up(
|
||||
&mut self,
|
||||
_event: &gpui::MouseUpEvent,
|
||||
_w: &mut Window,
|
||||
_cx: &mut Self::Context,
|
||||
) {
|
||||
}
|
||||
fn on_mouse_move(
|
||||
&mut self,
|
||||
_event: &gpui::MouseMoveEvent,
|
||||
_text_position: gpui::Point<gpui::Pixels>,
|
||||
_w: &mut Window,
|
||||
_cx: &mut Self::Context,
|
||||
) {
|
||||
}
|
||||
fn on_mouse_up(&mut self, _event: &gpui::MouseUpEvent, _w: &mut Window, _cx: &mut App) {}
|
||||
fn on_mouse_move(&mut self, _event: &gpui::MouseMoveEvent, _w: &mut Window, _cx: &mut App) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user