pub struct InputHandler {
pub modifiers: Modifiers,
pub left_option_key_mode: OptionKeyMode,
pub right_option_key_mode: OptionKeyMode,
/* private fields */
}Expand description
Input handler for converting winit events to terminal input
Fields§
§modifiers: Modifiers§left_option_key_mode: OptionKeyModeOption key mode for left Option/Alt key
right_option_key_mode: OptionKeyModeOption key mode for right Option/Alt key
Implementations§
Source§impl InputHandler
impl InputHandler
Sourcepub fn new() -> InputHandler
pub fn new() -> InputHandler
Create a new input handler
Sourcepub fn update_modifiers(&mut self, modifiers: Modifiers)
pub fn update_modifiers(&mut self, modifiers: Modifiers)
Update the current modifier state
Sourcepub fn update_option_key_modes(
&mut self,
left: OptionKeyMode,
right: OptionKeyMode,
)
pub fn update_option_key_modes( &mut self, left: OptionKeyMode, right: OptionKeyMode, )
Update Option/Alt key modes from config
Sourcepub fn track_alt_key(&mut self, event: &KeyEvent)
pub fn track_alt_key(&mut self, event: &KeyEvent)
Track Alt key press/release to know which Alt is active
Sourcepub fn handle_key_event(&mut self, event: KeyEvent) -> Option<Vec<u8>>
pub fn handle_key_event(&mut self, event: KeyEvent) -> Option<Vec<u8>>
Convert a keyboard event to terminal input bytes
If modify_other_keys_mode is > 0, keys with modifiers will be reported
using the XTerm modifyOtherKeys format: CSI 27 ; modifier ; keycode ~
Sourcepub fn handle_key_event_with_mode(
&mut self,
event: KeyEvent,
modify_other_keys_mode: u8,
application_cursor: bool,
) -> Option<Vec<u8>>
pub fn handle_key_event_with_mode( &mut self, event: KeyEvent, modify_other_keys_mode: u8, application_cursor: bool, ) -> Option<Vec<u8>>
Convert a keyboard event to terminal input bytes with modifyOtherKeys support
modify_other_keys_mode:
- 0: Disabled (normal key handling)
- 1: Report modifiers for special keys only
- 2: Report modifiers for all keys
application_cursor: When true (DECCKM mode enabled), arrow keys send
SS3 sequences (ESC O A) instead of CSI sequences (ESC [ A).
Sourcepub fn paste_from_clipboard(&mut self) -> Option<String>
pub fn paste_from_clipboard(&mut self) -> Option<String>
Paste text from clipboard (returns raw text, caller handles terminal conversion)
Sourcepub fn clipboard_has_image(&mut self) -> bool
pub fn clipboard_has_image(&mut self) -> bool
Check if clipboard contains an image (used when text paste returns None to determine if we should forward the paste event to the terminal for image-aware applications like Claude Code)
Sourcepub fn copy_to_primary_selection(&mut self, text: &str) -> Result<(), String>
pub fn copy_to_primary_selection(&mut self, text: &str) -> Result<(), String>
Copy text to primary selection (Linux X11 only)
Sourcepub fn paste_from_primary_selection(&mut self) -> Option<String>
pub fn paste_from_primary_selection(&mut self) -> Option<String>
Paste text from primary selection (Linux X11 only, returns raw text)
Trait Implementations§
Source§impl Default for InputHandler
impl Default for InputHandler
Source§fn default() -> InputHandler
fn default() -> InputHandler
Auto Trait Implementations§
impl Freeze for InputHandler
impl !RefUnwindSafe for InputHandler
impl Send for InputHandler
impl Sync for InputHandler
impl Unpin for InputHandler
impl UnsafeUnpin for InputHandler
impl !UnwindSafe for InputHandler
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().