Skip to main content

TaskRenderer

Struct TaskRenderer 

Source
pub struct TaskRenderer { /* private fields */ }
Expand description

Renderer facade that forwards every call to a background OS thread. Implements the Renderer trait so the event loop can use it as a drop-in replacement for AnsiRenderer / PlainRenderer — the wire protocol is the same UiLine enum.

Implementations§

Source§

impl TaskRenderer

Source

pub fn new(inner: Box<dyn Renderer>) -> Self

Spawn the worker thread, handing it ownership of the inner renderer. After this returns the caller interacts with the inner renderer only via the returned facade.

Trait Implementations§

Source§

impl Drop for TaskRenderer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Renderer for TaskRenderer

Source§

fn render(&mut self, line: UiLine)

Emit one UiLine. Implementations may batch internally; call flush() to force.
Source§

fn flush(&mut self)

Source§

fn shutdown(&mut self)

Shutdown: disable bracketed paste, disable raw mode, etc.
Source§

fn reset(&mut self)

Forget all cached rendering state (footer rows, last footer snapshot, assistant-text mid-line buffer, markdown parser) AND clear the physical terminal screen. Used by callers that hand control back to a non-TUI process (e.g. the blocking OAuth flow in /login) and then want a clean slate — without this, the next render tries to erase_footer at a position the terminal cursor is no longer at, corrupting every subsequent ANSI cursor move.
Source§

fn clear_screen(&mut self)

Wipe the physical terminal with \x1b[2J\x1b[H and flush. Does not touch cached footer/stream state — callers that want a full state wipe should call reset() instead. Use this when only the visible scrollback should be cleared (e.g. the /clear command after which the footer immediately redraws).
Source§

fn suspend_for_external(&mut self)

Hand the terminal off to a non-TUI child process (blocking OAuth flow, /shell, etc.): disable raw mode + bracketed paste, finish any pending writes. After this returns, the child is free to use the terminal in cooked mode; resume_from_external() must be called before any further render() calls.
Source§

fn resume_from_external(&mut self)

Take the terminal back after suspend_for_external(): re-enable raw mode + bracketed paste AND call reset() to wipe the cached state (the child wrote to stdout in cooked mode, so our cursor tracking is now lying).
Source§

fn flush_deferred(&mut self)

Paint any throttled payload that’s been sitting in the deferred queue past its throttle window. Called from the event loop on a ~50fps timer so the “trailing edge” of a burst of input renders actually lands — without this tick a lone stale payload would stay invisible until the next unrelated render arrived. Read more
Source§

fn on_resize(&mut self, cols: u16, rows: u16)

Terminal window was resized to (cols, rows). DECSTBM-based renderers must re-issue the scroll region (\x1b[1;H-N r) so the fixed footer stays pinned to the new bottom. Non-DECSTBM renderers can treat this as a redraw hint or a no-op. Read more
Source§

fn pop_approval_prompt(&mut self)

Remove the most recent ApprovalPrompt body row, if the tail row is one. Called by the event loop after the user responds Y/A/N so the prompt stops sitting in the body above the footer. Default: no-op — implementations that stream body lines to stdout (plain/pipe mode) can’t retract them.
Source§

fn scroll_body(&mut self, delta: i32)

Scroll the body viewport up (negative delta) or down (positive delta) by delta rows. Used by AltScreenRenderer to support PageUp / PageDown / arrow-up scrollback navigation inside the alt-screen (where the host terminal’s native scrollback is unavailable). Read more
Source§

fn scroll_body_to_top(&mut self)

Jump the body viewport to the absolute top / bottom of scrollback. Used for Home / End key handling.
Source§

fn scroll_body_to_bottom(&mut self)

Source§

fn begin_selection(&mut self, col: u16, row: u16)

Mouse text-selection hooks. Backends that own mouse capture can override these; streaming/native-scrollback backends keep host terminal selection behavior and no-op here.
Source§

fn update_selection(&mut self, col: u16, row: u16)

Source§

fn end_selection(&mut self)

Source§

fn copy_selection(&mut self) -> bool

Copy the current mouse-selection text to the system clipboard (using arboard, not OSC 52) and clear the selection highlight. Returns true if a non-empty selection was copied. Read more
Source§

fn refresh_welcome_banner(&mut self, _model: &str, _working_dir: &str)

Update the cached welcome banner’s model / working_dir fields in place and trigger a repaint of the banner rows. Used after the QR-onboarding /codingplan claim finishes: the banner was painted at the top of scrollback with model="" (the claim hadn’t picked a default provider yet) — once the claim writes ctx.model_name, this hook splices the resolved model into the existing banner rows so the user doesn’t see a permanently blank model bullet. Read more

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more