pub struct DefaultHost { /* private fields */ }Expand description
Default no-op Host implementation. Suitable for tests, headless
embedding, or any host that doesn’t yet need clipboard / cursor-shape
/ cancellation plumbing.
Behaviour:
write_clipboardstores the most recent payload in an in-memory slot;read_clipboardreturns it. Round-trip-only — no OS-level clipboard touched.nowreturns wall-clock duration since construction.prompt_searchreturnsNone(search is aborted).emit_cursor_shaperecords the most recent shape; readable viaDefaultHost::last_cursor_shape.emit_intentdiscards intents (intent type is()).
Implementations§
Source§impl DefaultHost
impl DefaultHost
Sourcepub const DEFAULT_VIEWPORT: Viewport
pub const DEFAULT_VIEWPORT: Viewport
Default viewport size for headless / test hosts: 80x24, no soft-wrap. Matches the conventional terminal default.
pub fn new() -> Self
Sourcepub fn with_viewport(viewport: Viewport) -> Self
pub fn with_viewport(viewport: Viewport) -> Self
Construct a DefaultHost with a custom initial viewport.
Useful for tests that want to exercise scrolloff math at a
specific window size.
Sourcepub fn last_cursor_shape(&self) -> CursorShape
pub fn last_cursor_shape(&self) -> CursorShape
Most recent cursor shape requested by the engine.
Trait Implementations§
Source§impl Debug for DefaultHost
impl Debug for DefaultHost
Source§impl Default for DefaultHost
impl Default for DefaultHost
Source§impl Host for DefaultHost
impl Host for DefaultHost
Source§type Intent = ()
type Intent = ()
Custom intent type. Hosts that don’t fan out actions back to
themselves can use the unit type via the default impl approach
(set associated type explicitly).
Source§fn write_clipboard(&mut self, text: String)
fn write_clipboard(&mut self, text: String)
Fire-and-forget clipboard write. Engine never blocks; the host
queues internally and flushes on its own task (OSC52,
wl-copy,
pbcopy, …).Source§fn read_clipboard(&mut self) -> Option<String>
fn read_clipboard(&mut self) -> Option<String>
Returns the last-known cached clipboard value. May be stale —
matches the OSC52/wl-paste model neovim and helix both ship.
Source§fn now(&self) -> Duration
fn now(&self) -> Duration
Monotonic time. Multi-key timeout (
timeoutlen) resolution
reads this; engine never reads Instant::now() directly so
macro replay stays deterministic.Source§fn prompt_search(&mut self) -> Option<String>
fn prompt_search(&mut self) -> Option<String>
Synchronously prompt the user for a search pattern. Returning
None aborts the search.Source§fn emit_cursor_shape(&mut self, shape: CursorShape)
fn emit_cursor_shape(&mut self, shape: CursorShape)
Engine emits this on every mode transition. Hosts repaint the
cursor in the requested shape.
Source§fn viewport(&self) -> &Viewport
fn viewport(&self) -> &Viewport
Borrow the host’s viewport. The host writes
width/height/
text_width/wrap per render frame; the engine reads/writes
top_row / top_col to scroll. 0.0.34 (Patch C-δ.1) moved
this off hjkl_buffer::Buffer onto Host.Source§fn viewport_mut(&mut self) -> &mut Viewport
fn viewport_mut(&mut self) -> &mut Viewport
Mutable viewport access. Engine motion + scroll code routes
here when scrolloff math advances
top_row.Source§fn emit_intent(&mut self, _intent: Self::Intent)
fn emit_intent(&mut self, _intent: Self::Intent)
Host-defined event the engine raises (LSP request, fold op,
buffer switch, …).
Source§fn should_cancel(&self) -> bool
fn should_cancel(&self) -> bool
Cooperative cancellation. Engine polls during long search /
regex / multi-cursor edit loops. Default returns
false.Source§fn display_line_for(&self, pos: Pos) -> u32
fn display_line_for(&self, pos: Pos) -> u32
Map a logical position to its display line for
gj/gk. Hosts
without wrapping may use the default identity impl.Auto Trait Implementations§
impl Freeze for DefaultHost
impl RefUnwindSafe for DefaultHost
impl Send for DefaultHost
impl Sync for DefaultHost
impl Unpin for DefaultHost
impl UnsafeUnpin for DefaultHost
impl UnwindSafe for DefaultHost
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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