Skip to main content

BuffrHost

Struct BuffrHost 

Source
pub struct BuffrHost {
    pub last_cursor_shape: CursorShape,
    /* private fields */
}
Expand description

Host adapter consumed by hjkl_engine::Editor once edit-mode is active.

Fields§

§last_cursor_shape: CursorShape

Last cursor shape requested by the engine. Drained by the host renderer per frame.

Implementations§

Source§

impl BuffrHost

Source

pub fn new() -> Self

Source

pub fn set_viewport_size(&mut self, width: u16, height: u16)

Publish the current canvas size into the viewport. Called from the host’s resize event handler (winit WindowEvent::Resized in apps/buffr). width / height are in cells, not pixels — buffr will divide pixel dimensions by font metrics before calling this once edit-mode rendering lands.

Currently unwired: buffr’s main loop drives CEF + softbuffer chrome and doesn’t yet route resizes into edit-mode. When the edit-mode overlay is plumbed, hook this in.

Source

pub fn set_clipboard_cache(&mut self, text: Option<String>)

Update the cached clipboard. Host calls this on focus events or when an OSC52 read reply arrives.

Source

pub fn drain_clipboard_outbox(&mut self) -> Vec<String>

Drain pending clipboard writes. Host’s tick loop calls this and dispatches each to the platform clipboard backend.

Source

pub fn drain_intents(&mut self) -> Vec<BuffrEditIntent>

Drain queued intents. Host calls this once per render frame.

Trait Implementations§

Source§

impl Debug for BuffrHost

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BuffrHost

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Host for BuffrHost

Source§

type Intent = BuffrEditIntent

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)

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>

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

Monotonic time. Multi-key timeout (timeoutlen) resolution reads this; engine never reads Instant::now() directly so macro replay stays deterministic.
Synchronously prompt the user for a search pattern. Returning None aborts the search.
Source§

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 emit_intent(&mut self, intent: Self::Intent)

Host-defined event the engine raises (LSP request, fold op, buffer switch, …).
Source§

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

Mutable viewport access. Engine motion + scroll code routes here when scrolloff math advances top_row.
Source§

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

Map a logical position to its display line for gj/gk. Hosts without wrapping may use the default identity impl.
Source§

fn pos_for_display(&self, line: u32, col: u32) -> Pos

Inverse of [display_line_for]. Default identity.
Source§

fn syntax_highlights(&self, range: Range<Pos>) -> Vec<Highlight>

Host-supplied syntax highlights for range. Empty by default; hosts wire tree-sitter or LSP semantic tokens here.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.