pub struct Composer { /* private fields */ }Implementations§
Source§impl Composer
impl Composer
Sourcepub fn on_resize(&mut self, width: u16)
pub fn on_resize(&mut self, width: u16)
Adopts a new terminal width, so wrapping and vertical cursor movement follow the rows the next layout will produce.
Sourcepub fn layout(&self, width: u16, theme: &Theme) -> ComposerLayout
pub fn layout(&self, width: u16, theme: &Theme) -> ComposerLayout
Lays the composer out for width columns: a rule, the wrapped input with
its @mentions highlighted, any attachments, and a closing rule.
Source§impl Composer
impl Composer
pub fn new() -> Self
pub fn text(&self) -> &str
pub fn is_empty(&self) -> bool
pub fn selected_mentions(&self) -> Vec<SelectedFileMention>
pub fn take_submission(&mut self) -> (String, Vec<PromptAttachment>)
pub fn clear(&mut self)
pub fn add_dropped_media(&mut self, paths: Vec<PathBuf>) -> bool
pub fn pending_media(&self) -> &[PromptAttachment]
Sourcepub fn apply_edit_key(&mut self, key: KeyEvent) -> bool
pub fn apply_edit_key(&mut self, key: KeyEvent) -> bool
Applies one shared editing keystroke. Anything that changes the text also ends history navigation, so the recalled prompt becomes the user’s draft.
pub fn insert_char(&mut self, character: char)
pub fn insert_str(&mut self, text: &str)
pub fn insert_paste(&mut self, text: &str)
pub fn insert_newline(&mut self)
pub fn backspace(&mut self)
pub fn move_left(&mut self)
pub fn move_line_start(&mut self)
pub fn move_line_end(&mut self)
Sourcepub fn move_up(&mut self) -> bool
pub fn move_up(&mut self) -> bool
Moves the cursor to the visual row above, reporting whether there was one. A long line the composer soft-wrapped has rows above without any newline before the cursor, so this follows what is on screen rather than the newlines in the text.
Sourcepub fn move_down(&mut self) -> bool
pub fn move_down(&mut self) -> bool
Moves the cursor to the visual row below, reporting whether there was one.
pub fn recall_previous(&mut self) -> bool
pub fn recall_next(&mut self) -> bool
pub fn open_command_picker(&mut self, commands: Vec<CommandEntry>)
Sourcepub fn open_file_picker(&mut self, root: &Path) -> FilesystemCommand
pub fn open_file_picker(&mut self, root: &Path) -> FilesystemCommand
Opens the @ picker and asks for the file index it will show. The walk
runs off the event loop, so opening the picker never stalls the keystroke
that triggered it.
pub fn on_files_indexed(&mut self, request_id: RequestId, files: Vec<FileEntry>)
pub fn has_completion(&self) -> bool
pub fn completion(&self) -> Option<&CompletionOverlay>
Sourcepub fn completion_mut(&mut self) -> Option<&mut CompletionOverlay>
pub fn completion_mut(&mut self) -> Option<&mut CompletionOverlay>
The open completion list, for navigation and stateful rendering.
pub fn prompt_search(&self) -> Option<&PromptSearchPicker>
Sourcepub fn prompt_search_mut(&mut self) -> Option<&mut PromptSearchPicker>
pub fn prompt_search_mut(&mut self) -> Option<&mut PromptSearchPicker>
The open prompt-history picker, for queries and stateful rendering.
pub fn has_open_overlay(&self) -> bool
Sourcepub fn on_overlay_mouse(&mut self, action: MouseAction, row: u16)
pub fn on_overlay_mouse(&mut self, action: MouseAction, row: u16)
Routes a mouse event to whichever overlay is open. Browsing history results previews each candidate in the composer, the way the arrow keys do.
pub fn has_prompt_search(&self) -> bool
pub fn open_prompt_search(&mut self)
Sourcepub fn on_prompt_search_key(&mut self, key: KeyEvent) -> Option<ComposerOutcome>
pub fn on_prompt_search_key(&mut self, key: KeyEvent) -> Option<ComposerOutcome>
Applies a keystroke to the open history search, or reports that there is none for it to go to.
Sourcepub fn on_prompt_search_paste(&mut self, text: &str) -> Option<ComposerOutcome>
pub fn on_prompt_search_paste(&mut self, text: &str) -> Option<ComposerOutcome>
Applies a paste to the open history search, or reports that there is none for it to go to.
Sourcepub fn on_completion_key(&mut self, key: KeyEvent) -> Option<ComposerOutcome>
pub fn on_completion_key(&mut self, key: KeyEvent) -> Option<ComposerOutcome>
Applies a keystroke to the open completion list, or reports that there is none for it to go to.
pub fn prompt_search_on_results(&mut self, response: PromptSearchResponse)
pub fn accept_command(&mut self) -> Option<CommandEntry>
pub fn accept_file(&mut self) -> Option<FileEntry>
pub fn refresh_overlay_query(&mut self)
pub fn cursor_position(&self) -> (usize, usize)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Composer
impl RefUnwindSafe for Composer
impl Send for Composer
impl Sync for Composer
impl Unpin for Composer
impl UnsafeUnpin for Composer
impl UnwindSafe for Composer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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