pub struct HighTerm { /* private fields */ }Expand description
Higher-level terminal prompt with completion support.
Implementations§
Source§impl HighTerm
impl HighTerm
Sourcepub fn run_with_external_terminal<T>(
&self,
callback: impl FnOnce() -> T,
) -> Result<T>
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.
Sourcepub 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)>
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.
Sourcepub 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)>
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.
Sourcepub 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)>
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.
Sourcepub 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)>
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.
Sourcepub fn handle(&self) -> &TermHandle
pub fn handle(&self) -> &TermHandle
Returns a reference to the TermHandle.
Sourcepub fn set_editor_context_handle(
&mut self,
editor_context: Arc<Mutex<EditorContext>>,
)
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.
Sourcepub fn edit_prompt_with_response(&mut self, response: String) -> Result<()>
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.
Sourcepub fn edit_prompt_with_chat(&mut self, chat_markdown: String) -> Result<()>
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.
Sourcepub fn set_theme(&mut self, theme: Theme)
pub fn set_theme(&mut self, theme: Theme)
Replaces the prompt UI theme for future local rendering.
Sourcepub fn replace_last_submitted_prompt(&mut self, text: String)
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.
Sourcepub fn pick_agent_row_with_fzf(
&self,
rows: &str,
) -> Result<Option<String>, ExternalProgramError>
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.
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.
Sourcepub fn print_output(
&self,
debug_id: impl Into<String>,
block: impl Into<StyledBlock>,
) -> BlockId
pub fn print_output( &self, debug_id: impl Into<String>, block: impl Into<StyledBlock>, ) -> BlockId
Appends persistent output to history.
Sourcepub fn get_next_event(&mut self) -> Result<Event>
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.
Sourcepub fn finalize_last_submitted_prompt_history(&mut self)
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.