pub struct EditSession { /* private fields */ }Expand description
One active edit-mode session bound to a single text field.
Owns the engine Editor generic over BuffrHost. The host
(clipboard / time / intent fan-out) lives inside the editor as of
hjkl 0.1.0 — Editor<hjkl_buffer::Buffer, BuffrHost>. Pull-model:
per render frame the host calls EditSession::take_content_change
and forwards any new content to the DOM.
Implementations§
Source§impl EditSession
impl EditSession
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> bool
pub fn handle_key(&mut self, key: KeyEvent) -> bool
Feed one keystroke. Returns true when the keystroke was
consumed by the engine; false means the caller should let
the page see it (<Esc> in normal mode, etc.).
Sourcepub fn feed_planned(&mut self, input: PlannedInput) -> bool
pub fn feed_planned(&mut self, input: PlannedInput) -> bool
Feed a hjkl_engine::PlannedInput directly. Bypasses the
crossterm conversion layer — used by the winit event path which
constructs PlannedInput from winit’s KeyEvent directly so
the two crates never need a shared crossterm version.
Sourcepub fn type_char(&mut self, ch: char) -> bool
pub fn type_char(&mut self, ch: char) -> bool
Convenience: type a literal character with no modifiers. Used by tests and by the JS bridge when forwarding plain printable keys.
Sourcepub fn press(&mut self, code: KeyCode) -> bool
pub fn press(&mut self, code: KeyCode) -> bool
Convenience: send a special key (Esc, Enter, etc.) with no modifiers.
Sourcepub fn type_str(&mut self, s: &str)
pub fn type_str(&mut self, s: &str)
Type a string in insert mode. Caller must already have entered
insert mode (type_char('i')); panics if asked to type while
not in insert.
Sourcepub fn take_content_change(&mut self) -> Option<Arc<String>>
pub fn take_content_change(&mut self) -> Option<Arc<String>>
Pull-model change drain. Returns the new content if anything
changed since the last call; None if nothing did. Host
forwards Some to the DOM.
Sourcepub fn drain_clipboard_outbox(&mut self) -> Vec<String>
pub fn drain_clipboard_outbox(&mut self) -> Vec<String>
Drain queued clipboard writes the engine has accumulated. Host’s tick loop dispatches each to CEF.
Sourcepub fn drain_intents(&mut self) -> Vec<BuffrEditIntent>
pub fn drain_intents(&mut self) -> Vec<BuffrEditIntent>
Drain queued intents (RequestAutocomplete, SwitchBuffer,
etc.). Host fans each out to its CEF / browser-action layer.
Auto Trait Implementations§
impl !Freeze for EditSession
impl RefUnwindSafe for EditSession
impl Send for EditSession
impl Sync for EditSession
impl Unpin for EditSession
impl UnsafeUnpin for EditSession
impl UnwindSafe for EditSession
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> 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