Skip to main content

HighTerm

Struct HighTerm 

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

Higher-level terminal prompt with completion support.

Implementations§

Source§

impl HighTerm

Source

pub fn run_with_external_terminal<T>( &self, callback: impl FnOnce() -> T, ) -> Result<T>

Runs an in-process interactive callback while it exclusively owns the terminal.

Tau pauses redraws and releases raw terminal features before invoking callback, then restores terminal state and requests a fresh repaint. A release failure prevents the callback from running. The resume guard also restores terminal state if the callback unwinds.

Source

pub fn new( left_prompt: impl Into<StyledText>, commands: Vec<CommandCompletion>, theme: Theme, bindings: impl IntoIterator<Item = (String, String)>, terminal_options: TerminalOptions, ) -> Result<(Self, TermHandle, CompletionData)>

Creates a new terminal with the given prompt and commands.

Returns the terminal, a thread-safe handle for rendering, and a CompletionData handle for pushing dynamic argument completions from background threads.

Source

pub fn new_with_input_history( left_prompt: impl Into<StyledText>, commands: Vec<CommandCompletion>, theme: Theme, bindings: impl IntoIterator<Item = (String, String)>, input_history: impl IntoIterator<Item = String>, terminal_options: TerminalOptions, ) -> Result<(Self, TermHandle, CompletionData)>

Creates a new terminal and seeds prompt input history.

Source

pub fn new_with_completion_rules( left_prompt: impl Into<StyledText>, commands: Vec<CommandCompletion>, theme: Theme, bindings: impl IntoIterator<Item = (String, String)>, input_history: impl IntoIterator<Item = String>, completion_rules: CompletionRules, terminal_options: TerminalOptions, ) -> Result<(Self, TermHandle, CompletionData)>

Creates a new terminal with explicit prompt completion rules.

Source

pub fn new_with_completion_rules_and_data( left_prompt: impl Into<StyledText>, commands: Vec<CommandCompletion>, theme: Theme, bindings: impl IntoIterator<Item = (String, String)>, input_history: impl IntoIterator<Item = String>, completion_rules: CompletionRules, terminal_options: TerminalOptions, data: CompletionData, ) -> Result<(Self, TermHandle)>

Creates a terminal with caller-owned mutable completion state.

Callers may populate this state before the input loop starts, then update it later from background owners through its shared handle.

Source

pub fn handle(&self) -> &TermHandle

Returns a reference to the TermHandle.

Source

pub fn set_editor_context_handle( &mut self, editor_context: Arc<Mutex<EditorContext>>, )

Replaces the editor-context storage with a shared handle.

Use this when another component (e.g. the event renderer) owns the authoritative context and needs the prompt’s external-editor integration to read conversation context and write prompt-trailer recovery state through the same Arc. The previously-owned EditorContext is dropped. EditorContext is dropped.

Source

pub fn edit_prompt_with_response(&mut self, response: String) -> Result<()>

Opens the ordinary prompt editor with one explicitly selected response.

The selected response temporarily replaces the renderer-published response context. Existing editor recovery survives the invocation, and any newly edited trailer text becomes the next recovery value.

Source

pub fn edit_prompt_with_chat(&mut self, chat_markdown: String) -> Result<()>

Opens the ordinary prompt editor with an exact Markdown chat export below the established trailer marker.

Terminal pause/resume, command failure, prompt replacement, and edited trailer recovery use the same path as shell-prompt-edit.

Source

pub fn set_theme(&mut self, theme: Theme)

Replaces the prompt UI theme for future local rendering.

Source

pub fn redraw(&self)

Triggers a redraw.

Source

pub fn replace_last_submitted_prompt(&mut self, text: String)

Replaces the most recently submitted prompt in navigation and search history.

Higher layers use this when a submitted line has a safer presentation form than the raw value that must remain available to the immediate routing stack.

Source

pub fn pick_agent_row_with_fzf( &self, rows: &str, ) -> Result<Option<String>, ExternalProgramError>

Runs the optional fzf agent-row picker while safely releasing raw mode.

rows must be headerless TSV with the stable agent id in field one. Cancellation returns Ok(None). The external fzf interaction uses a five-minute command timeout, including for an empty input roster. Tau checks foreground restoration after settling fzf and preserves the primary outcome or failure alongside any restoration failure. If ownership remains unconfirmed, the caller must exit the affected attachment without resuming terminal input or output.

Source

pub fn dismiss_completion_menu(&mut self) -> bool

Closes the active completion menu, if any, and updates its rendered block.

Returns true when a menu was open. Call this from application-level state transitions that make the active completion context stale but do not otherwise change the prompt buffer. Dismissing a previewed candidate may restore the previous buffer and cursor; this method updates the rendered menu but does not emit a Event::BufferChanged event.

Source

pub fn print_output( &self, debug_id: impl Into<String>, block: impl Into<StyledBlock>, ) -> BlockId

Appends persistent output to history.

Source

pub fn get_next_event(&mut self) -> Result<Event>

Blocks until the next high-level event, syncing the completion menu block to the raw term’s current state.

Source

pub fn finalize_last_submitted_prompt_history(&mut self)

Bounds both histories after the input loop has finalized this submission’s canonical or redacted presentation.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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