pub struct InputExtension { /* private fields */ }Expand description
InputExtension: default editor keybindings (basic/text-editor mode). Arrow keys move cursor, typing inserts directly, no mode switching. Alt-x (M-x) opens an Emacs-style command prompt for running commands. Vi-style keybindings are provided by ViInputExtension (see vi_input.rs).
Implementations§
Source§impl InputExtension
impl InputExtension
pub fn new() -> Self
pub fn set_active(&mut self, active: bool)
pub fn is_active(&self) -> bool
Sourcepub fn handle_key(&mut self, key: &KeyEvent) -> Option<String>
pub fn handle_key(&mut self, key: &KeyEvent) -> Option<String>
Handle a key event. Returns the command string to run, or None. In Basic mode, arrow keys and printable chars generate commands. Note: Alt+x is NOT handled here — it’s intercepted by render.rs before reaching this method, making it mode-independent.
Sourcepub fn register_layers(&self, reg: &mut KeymapRegistry)
pub fn register_layers(&self, reg: &mut KeymapRegistry)
Register this extension’s default keybindings as a named layer in the central KeymapRegistry. The extension owns its mode name — the registry and main.rs never need to know about “basic” or “vi”.
Trait Implementations§
Source§impl Default for InputExtension
impl Default for InputExtension
Source§impl Extension for InputExtension
impl Extension for InputExtension
Source§fn global_bindings(&self) -> Vec<(&'static str, &'static str)>
fn global_bindings(&self) -> Vec<(&'static str, &'static str)>
Global bindings: scroll/navigation keys available in all modes. These are merged into the global layer by main.rs — no hardcoded key strings in main.rs beyond M-x.
fn name(&self) -> &str
fn init(&mut self, _runtime: &mut Runtime) -> Result<(), Box<dyn Error>>
fn shutdown(&mut self, _runtime: &mut Runtime) -> Result<(), Box<dyn Error>>
fn on_key(&mut self, _ch: char) -> Result<(), Box<dyn Error>>
fn on_render(&mut self, _runtime: &Runtime) -> Result<(), Box<dyn Error>>
fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn register_commands(
&mut self,
_runtime: &mut EditorRuntime,
) -> Result<(), Box<dyn Error>>
fn register_commands( &mut self, _runtime: &mut EditorRuntime, ) -> Result<(), Box<dyn Error>>
Auto Trait Implementations§
impl Freeze for InputExtension
impl RefUnwindSafe for InputExtension
impl Send for InputExtension
impl Sync for InputExtension
impl Unpin for InputExtension
impl UnsafeUnpin for InputExtension
impl UnwindSafe for InputExtension
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more